> > However, when I try to generate MARCXML output with following code the >> > Arabic characters gets corrupted: >> >> > $xml = MARC::File::XML->out( $file ); >> > my $record = MARC::Record->new(); >> > ... >> > $xml->write( $record ); >> > ... >> > $xml->close(); >> >> > I've tried setting the encoding in various ways without success, e.g.: >> > => use MARC::File::XML ( BinaryEncoding => 'utf8', RecordFormat => >> > 'USMARC' >> >> What is the value of you records leader position 9? If you have anything >> else than 'a', MARC::File::XML->write method will transcode your biblio >> records from marc8 to utf8 encoding. That's bad if your records are >> already UTF-8 encoded. >> >> You can try forcing your records 9 position before writing them: >> >> my $leader = $record->leader; >> substr($leader, 9, 1, 'a'); >> $record->leader( $leader ); >> > > I had already hard-coded the position 9 in Leader as 'a' in all records. > Little strange that MARC:File:USMARC and MARC:File:XML treat the same data > (rather same MARC::Record object) differently. >
I am now able to get proper utf8 data in MARCXML output with this option: my $xml = MARC::File::XML->out( $file, ':raw' ); I think M:F:X tries to convert everything to utf8 (due to XML compliance) unlike M:F:USMARC. Saiful Amin +91-9343826438