Still hacking for Koha 3.0
I face a very strange problem. Here is the description :
- I add a biblio with some unicode => works fine.
- I modify the biblio => still works fine.
- I add an item => OK
- I modify the biblio again => reading the biblio on database is OK, but
when saving it, all accented chars are reencoded.
In Koha, the biblio and the items are stored in a MARC::Record (in XML
in the database).
When you update a biblio, Koha does :
- get the biblio you just edit
#retrieve the revious complete record
my $oldRecord = GetMarcBiblio( $biblionumber );
# retrieve items
my @fields = $oldRecord->field( $itemtag );
# append them to new record
$record->append_fields( @fields );
- save the biblio.
I have Dumper()-ed the records before and after the append_fields = they
are the same.
I have as_formatted-ed the record before and after the append_fields =
they differ.
Seems Perl has forgotten that the $record is utf8 and he reencodes the
record.
Any idea to solve the problem ?
Here is the Dumper and the as_formatted I get before and after inserting
the field :
BEFORE : $VAR1 = bless( {
'_leader' => '00230 2200097 4500',
'_warnings' => [],
'_fields' => [
bless( {
'_is_control_field' => 1,
'_data' => '',
'_warnings' => [],
'_tag' => '009'
}, 'MARC::Field' ),
bless( {
'_is_control_field' => '',
'_ind2' => ' ',
'_subfields' => [
'a',
'20070809 frey50 '
],
'_warnings' => [],
'_tag' => 100,
'_ind1' => ' '
}, 'MARC::Field' ),
bless( {
'_is_control_field' => '',
'_ind2' => ' ',
'_subfields' => [
'a',
'title \xc3\xa9 / \xc3\xa0'<<<<<<<< interesting line
],
'_warnings' => [],
'_tag' => 200,
'_ind1' => ' '
}, 'MARC::Field' )
]
}, 'MARC::Record' );
as formatted :
==================
LDR 00230 2200097 4500
009
100 _a20070809 frey50
200 _atitle \xc3\xa9 / \xc3\xa0 <<<<<<<< interesting line
INSERT :
======================
$VAR1 = bless( {
'_is_control_field' => '',
'_ind2' => ' ',
'_subfields' => [
'b',
'SED',
'c',
'SED',
'e',
'Magasin',
'k',
'item callnumber',
'o',
'0',
'f',
'12346598',
'9',
'58433'
],
'_warnings' => [],
'_tag' => 995,
'_ind1' => ' '
}, 'MARC::Field' );
AFTER :
=================
$VAR1 = bless( {
'_leader' => '00230 2200097 4500',
'_warnings' => [],
'_fields' => [
bless( {
'_is_control_field' => 1,
'_data' => '',
'_warnings' => [],
'_tag' => '009'
}, 'MARC::Field' ),
bless( {
'_is_control_field' => '',
'_ind2' => ' ',
'_subfields' => [
'a',
'20070809 frey50 '
],
'_warnings' => [],
'_tag' => 100,
'_ind1' => ' '
}, 'MARC::Field' ),
bless( {
'_is_control_field' => '',
'_ind2' => ' ',
'_subfields' => [
'a',
'title \xc3\xa9 / \xc3\xa0'<<<<<<<< interesting line
],
'_warnings' => [],
'_tag' => 200,
'_ind1' => ' '
}, 'MARC::Field' ),
bless( {
'_is_control_field' => '',
'_ind2' => ' ',
'_subfields' => [
'b',
'SED',
'c',
'SED',
'e',
'Magasin',
'k',
'item callnumber',
'o',
'0',
'f',
'12346598',
'9',
'58433'
],
'_warnings' => [],
'_tag' => 995,
'_ind1' => ' '
}, 'MARC::Field' )
]
}, 'MARC::Record' );
as formatted : LDR 00230 2200097 4500
009
100 _a20070809 frey50
200 _atitle \xc3\x83\xc2\xa9 / \xc3\x83\xc2\xa0 <<<< interesting line
995 _bSED
_cSED
_eMagasin
_kitem callnumber
_o0
_f12346598
_958433 at /home/paul/koha.dev/head/C4/Biblio.pm line 387.
--
Paul POULAIN et Henri Damien LAURENT
Consultants indépendants en logiciels libres et bibliothéconomie
(http://www.koha-fr.org)
Tel : 04 91 31 45 19