koha-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Joshua Ferraro
Subject: [Koha-cvs] koha/acqui.simple addbiblio.pl [rel_2_2]
Date: Fri, 10 Mar 2006 02:35:07 +0000

CVSROOT:        /sources/koha
Module name:    koha
Branch:         rel_2_2
Changes by:     Joshua Ferraro <address@hidden> 06/03/10 02:35:07

Modified files:
        acqui.simple   : addbiblio.pl 

Log message:
        IMPORTANT:
        
        MARC::Record objects coming in from the reservoir are probably going to
        be encoded as MARC-8. This enures that they will be converted into UTF-8
        before being displayed to the user (if they are in fact MARC-8). It's 
most
        easily done by turning the record into a MARC::File::XML object and then
        going back to MARC::Record -- easiest to do for me that is. Of course, a
        better solution is to create a routine that changes the encoding of a
        MARC::Record object (I was surprised to find such did not exist). I have
        tested this method for MARC21, but I'm not familiar with the issues with
        encoding in UNIMARC: are UNIMARC records ever encoded in charater sets
        other than MARC-8 and UTF-8? (if so, I will need to adjust this code).

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.23&tr2=1.52.2.24&r1=text&r2=text

Patches:
Index: koha/acqui.simple/addbiblio.pl
diff -u koha/acqui.simple/addbiblio.pl:1.52.2.23 
koha/acqui.simple/addbiblio.pl:1.52.2.24
--- koha/acqui.simple/addbiblio.pl:1.52.2.23    Mon Mar  6 03:40:44 2006
+++ koha/acqui.simple/addbiblio.pl      Fri Mar 10 02:35:07 2006
@@ -1,6 +1,6 @@
 #!/usr/bin/perl
 
-# $Id: addbiblio.pl,v 1.52.2.23 2006/03/06 03:40:44 kados Exp $
+# $Id: addbiblio.pl,v 1.52.2.24 2006/03/10 02:35:07 kados Exp $
 
 # Copyright 2000-2002 Katipo Communications
 #
@@ -164,6 +164,9 @@
 =cut
 sub create_input () {
        my ($tag,$subfield,$value,$i,$tabloop,$rec,$authorised_values_sth) = @_;
+       # must be encoded as utf-8 before it reaches the editor
+        use Encode;
+        $value = encode('utf-8', $value);
        $value =~ s/"/&quot;/g;
        my $dbh = C4::Context->dbh;
        my %subfield_data;
@@ -430,6 +433,7 @@
        my @ind_tag = $input->param('ind_tag');
        my @indicator = $input->param('indicator');
        my $xml = 
MARChtml2xml(address@hidden,address@hidden,address@hidden,address@hidden,address@hidden);
+       warn "XML HERE".$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);
@@ -512,8 +516,10 @@
                $bibid = "";
                $oldbiblionumber= "";
        }
- 
-       build_tabs ($template, $record, $dbh,$encoding);
+       #FIXME: it's kind of silly to go from MARC::Record to MARC::File::XML 
and then back again just to fix the encoding
+        my $uxml = $record->as_xml;
+        my $urecord = MARC::Record::new_from_xml($uxml, 'UTF-8'); 
+       build_tabs ($template, $urecord, $dbh,$encoding);
        build_hidden_data;
        $template->param(
                oldbiblionumber             => $oldbiblionumber,




reply via email to

[Prev in Thread] Current Thread [Next in Thread]