Hello perl4lib,

I have some problems decoding unimarc XML datas.

> $record = MARC::Record::new_from_xml( $marcxml,"utf8","unimarc");

gives me a wrong encoding result, while

> $record = MARC::Record::new_from_xml( $marcxml,"utf8");

gives me a correct one.

As I have unimarc records, i'm not happy with that... so I have investigated MARC::File::XML and found at line 448 :

> $parser->{ Handler }{ toMARC8 } = (lc($format) ne 'unimarc' && $enc && lc($enc) =~ /^utf-?8$/o) ? 0 : 1;

meaning that for "unimarc" we want to set toMARC8 flag for MARC8 decoding.

unimarc not in utf-8 are in latin1, meaning no MARC8 decoding is needed.

Thus, I would have written :

> $parser->{ Handler }{ toMARC8 } = (lc($format) *eq* 'unimarc' && $enc && lc($enc) =~ /^utf-?8$/o) ? 0 : 1;

to flag the toMARC8 ONLY for MARC21 not already in utf8.

Am I right or missing something ?

--
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

Reply via email to