koha-cvs
[Top][All Lists]
Advanced

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

[Koha-cvs] koha/z3950 search.pl [dev_week]


From: Ryan Higgins
Subject: [Koha-cvs] koha/z3950 search.pl [dev_week]
Date: Fri, 23 Mar 2007 20:58:17 +0000

CVSROOT:        /sources/koha
Module name:    koha
Branch:         dev_week
Changes by:     Ryan Higgins <rych>     07/03/23 20:58:16

Modified files:
        z3950          : search.pl 

Log message:
        fixing encoding problem - yet another roundtrip 

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/z3950/search.pl?cvsroot=koha&only_with_tag=dev_week&r1=1.3.2.6.2.4&r2=1.3.2.6.2.5

Patches:
Index: search.pl
===================================================================
RCS file: /sources/koha/koha/z3950/Attic/search.pl,v
retrieving revision 1.3.2.6.2.4
retrieving revision 1.3.2.6.2.5
diff -u -b -r1.3.2.6.2.4 -r1.3.2.6.2.5
--- search.pl   2 Jan 2007 16:40:34 -0000       1.3.2.6.2.4
+++ search.pl   23 Mar 2007 20:58:16 -0000      1.3.2.6.2.5
@@ -171,6 +171,19 @@
                                my $marcrecord;
                                $marcdata = $rec->raw();                        
                                                                
                                $marcrecord = 
MARC::File::USMARC::decode($marcdata);
+                               my $xmlrecord = $marcrecord->as_xml;
+                               my $newmarcrecord;
+                               eval {
+                                       $newmarcrecord = 
MARC::Record::new_from_xml($xmlrecord,'UTF-8');
+                               };
+                               if ($@) {
+                                       warn "MARC from Z3950 has a problem:";
+                                       warn DUMP $xmlrecord;
+                                       warn DUMP2 $newmarcrecord->as_usmarc();
+                                       warn $@;
+                                       next;                
+                               }
+                               my $recordstring = $newmarcrecord->as_usmarc();
 ####WARNING records coming from Z3950 clients are in various character sets 
MARC8,UTF8,UNIMARC etc
 ## In HEAD i change everything to UTF-8
 # In rel2_2 i am not sure what encoding is so no character conversion is done 
here
@@ -178,7 +191,7 @@
                                my $oldbiblio = 
MARCmarc2koha($dbh,$marcrecord,"");
                                $oldbiblio->{isbn} =~ s/ |-|\.//g,
                                $oldbiblio->{issn} =~ s/ |-|\.//g,
-                               my 
($notmarcrecord,$alreadyindb,$alreadyinfarm,$imported,$bid)=ImportBreeding($marcdata,1,$serverhost[$k],$encoding[$k],$random);
+                               my 
($notmarcrecord,$alreadyindb,$alreadyinfarm,$imported,$bid)=ImportBreeding($recordstring,1,$serverhost[$k],$encoding[$k],$random);
                                my $warnings;
                                $warnings = "Invalid MARC record" if 
($notmarcrecord);
                                $warnings .= "\nThis record already exists in 
catalog" if ($alreadyindb);




reply via email to

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