[Koha-cvs] koha/acqui.simple addbiblio.pl additem.pl [rel_2_2]

Joshua Ferraro jmf at kados.org
Sat Mar 4 18:10:49 CET 2006


CVSROOT:	/sources/koha
Module name:	koha
Branch: 	rel_2_2
Changes by:	Joshua Ferraro <kados at savannah.gnu.org>	06/03/04 17:10:48

Modified files:
	acqui.simple   : addbiblio.pl additem.pl 

Log message:
	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 !!!!!

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/koha/acqui.simple/addbiblio.pl.diff?only_with_tag=rel_2_2&tr1=1.52.2.21&tr2=1.52.2.22&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/koha/koha/acqui.simple/additem.pl.diff?only_with_tag=rel_2_2&tr1=1.27.2.13&tr2=1.27.2.14&r1=text&r2=text

Patches:
Index: koha/acqui.simple/addbiblio.pl
diff -u koha/acqui.simple/addbiblio.pl:1.52.2.21 koha/acqui.simple/addbiblio.pl:1.52.2.22
--- koha/acqui.simple/addbiblio.pl:1.52.2.21	Wed Mar  1 02:13:45 2006
+++ koha/acqui.simple/addbiblio.pl	Sat Mar  4 17:10:48 2006
@@ -1,6 +1,6 @@
 #!/usr/bin/perl
 
-# $Id: addbiblio.pl,v 1.52.2.21 2006/03/01 02:13:45 kados Exp $
+# $Id: addbiblio.pl,v 1.52.2.22 2006/03/04 17:10:48 kados Exp $
 
 # Copyright 2000-2002 Katipo Communications
 #
@@ -430,7 +430,7 @@
 	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 @@
 		$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' => "");
Index: koha/acqui.simple/additem.pl
diff -u koha/acqui.simple/additem.pl:1.27.2.13 koha/acqui.simple/additem.pl:1.27.2.14
--- koha/acqui.simple/additem.pl:1.27.2.13	Wed Mar  1 17:25:11 2006
+++ koha/acqui.simple/additem.pl	Sat Mar  4 17:10:48 2006
@@ -1,6 +1,6 @@
 #!/usr/bin/perl
 
-# $Id: additem.pl,v 1.27.2.13 2006/03/01 17:25:11 kados Exp $
+# $Id: additem.pl,v 1.27.2.14 2006/03/04 17:10:48 kados Exp $
 
 # Copyright 2000-2002 Katipo Communications
 #
@@ -80,7 +80,7 @@
 	#	$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 @@
 	#	$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;





More information about the Koha-cvs mailing list