[sword-svn] r82 - trunk/modules/perlconverters
chrislit at www.crosswire.org
chrislit at www.crosswire.org
Mon Apr 23 14:13:24 MST 2007
Author: chrislit
Date: 2007-04-23 14:13:23 -0700 (Mon, 23 Apr 2007)
New Revision: 82
Modified:
trunk/modules/perlconverters/zef2osis.pl
Log:
added detection/conversion of Latin-1 files
Modified: trunk/modules/perlconverters/zef2osis.pl
===================================================================
--- trunk/modules/perlconverters/zef2osis.pl 2007-04-23 10:27:36 UTC (rev 81)
+++ trunk/modules/perlconverters/zef2osis.pl 2007-04-23 21:13:23 UTC (rev 82)
@@ -93,11 +93,17 @@
return $iline;
}
+$enc = "utf8";
+
$q = 0;
foreach $line (@data) {
if ($pr == 1) {
+ if ($enc ne "utf8") {
+ utf8::encode($line);
+ }
+
$line =~ s/[\r\n]+/\n/g;
$line =~ s/^\s+//;
$line =~ s/\s+$//;
@@ -167,7 +173,11 @@
print OUTF "$line\n";
}
}
- if ($line =~ /<\/INFORMATION>/) {
+ elsif ($line =~ /<\?xml .*?encoding=\"[Ii][Ss][Oo]\-8859\-1\"\?>/) {
+ use encoding 'latin1';
+ $enc = "latin1";
+ }
+ elsif ($line =~ /<\/INFORMATION>/) {
$pr = 1;
}
More information about the sword-cvs
mailing list