VERY IMPORTANT NOTES!!! READ OR YOU MAY RUIN YOUR ENCODING
Previous commits replaced the use of the MARChtml2marc routine with a MARChtml2xml that reads in the form data and converts it to a MARC::File::XML object. It then passes that to MARC::Record via the new_from_xml() method. This works perfectly and fixes all of the bugs with the old MARChtml2marc routine (see mail to koha-devel). However, there is one gotcha. The MARC::File::XML new_from_xml() method converts UTF-8 data into MARC-8 by default for historical reasons. This means that entry of characters outside the normal ascii range in UTF-8 will come out as gibberish in MARC-8. Never fear, there is a solution. This commit uses code written for MARC::File::XML version 0.82 to add the ability to specify the encoding desired (I chose UTF-8 because I can't think of a reason to ever need MARC-8) The bottom line is that to properly encode records YOU WILL HAVE TO UPDATE MARC::File::XML to at least CPAN verion 0.82 !!!!!
This commit is contained in:
parent
9f281d3e51
commit
e2787e32d0
|
|
@ -430,7 +430,7 @@ if ($op eq "addbiblio") {
|
|||
my @ind_tag = $input->param('ind_tag');
|
||||
my @indicator = $input->param('indicator');
|
||||
my $xml = MARChtml2xml(\@tags,\@subfields,\@values,\@indicator,\@ind_tag);
|
||||
my $record=MARC::Record::new_from_xml($xml);
|
||||
my $record=MARC::Record::new_from_xml($xml, 'UTF-8');
|
||||
# check for a duplicate
|
||||
my ($duplicatebiblionumber,$duplicatebibid,$duplicatetitle) = FindDuplicate($record) if ($op eq "addbiblio") && (!$is_a_modif);
|
||||
my $confirm_not_duplicate = $input->param('confirm_not_duplicate');
|
||||
|
|
@ -481,7 +481,7 @@ if ($op eq "addbiblio") {
|
|||
$indicators{$ind_tag[$i]} = $indicator[$i];
|
||||
}
|
||||
my $xml = MARChtml2xml(\@tags,\@subfields,\@values,\@indicator,\@ind_tag);
|
||||
my $record=MARC::Record::new_from_xml($xml);
|
||||
my $record=MARC::Record::new_from_xml($xml, 'UTF-8');
|
||||
#my $record = MARChtml2marc($dbh,\@tags,\@subfields,\@values,%indicators);
|
||||
# adding an empty field
|
||||
my $field = MARC::Field->new("$addedfield",'','','$tagaddfield_subfield' => "");
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ if ($op eq "additem") {
|
|||
# $indicators{$ind_tag[$i]} = $indicator[$i];
|
||||
#}
|
||||
my $xml = MARChtml2xml(\@tags,\@subfields,\@values,\@indicator,\@ind_tag);
|
||||
my $record=MARC::Record::new_from_xml($xml);
|
||||
my $record=MARC::Record::new_from_xml($xml, UTF-8);
|
||||
#my $record = MARChtml2marc($dbh,\@tags,\@subfields,\@values,%indicators);
|
||||
# if autoBarcode is ON, calculate barcode...
|
||||
if (C4::Context->preference('autoBarcode')) {
|
||||
|
|
@ -138,7 +138,7 @@ if ($op eq "additem") {
|
|||
# $indicators{$ind_tag[$i]} = $indicator[$i];
|
||||
#}
|
||||
my $xml = MARChtml2xml(\@tags,\@subfields,\@values,\@indicator,\@ind_tag);
|
||||
my $record=MARC::Record::new_from_xml($xml);
|
||||
my $record=MARC::Record::new_from_xml($xml, UTF-8);
|
||||
#my $record = MARChtml2marc($dbh,\@tags,\@subfields,\@values,%indicators);
|
||||
# MARC::Record builded => now, record in DB
|
||||
# warn "R: ".$record->as_formatted;
|
||||
|
|
|
|||
Loading…
Reference in New Issue