diff options
author | Chris Little <chrislit@crosswire.org> | 2007-04-23 21:13:23 +0000 |
---|---|---|
committer | Chris Little <chrislit@crosswire.org> | 2007-04-23 21:13:23 +0000 |
commit | f7f95effe736c3a2a84f02cf405770b850fe1489 (patch) | |
tree | 3de89e8455c7b32130d8abc7c6b77afbc09362fe /modules/perlconverters | |
parent | d3050a680e57f16131125a944777f251c3b5a8c5 (diff) | |
download | sword-tools-f7f95effe736c3a2a84f02cf405770b850fe1489.tar.gz |
added detection/conversion of Latin-1 files
git-svn-id: https://www.crosswire.org/svn/sword-tools/trunk@82 07627401-56e2-0310-80f4-f8cd0041bdcd
Diffstat (limited to 'modules/perlconverters')
-rw-r--r-- | modules/perlconverters/zef2osis.pl | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/modules/perlconverters/zef2osis.pl b/modules/perlconverters/zef2osis.pl index be740d0..848a489 100644 --- a/modules/perlconverters/zef2osis.pl +++ b/modules/perlconverters/zef2osis.pl @@ -93,11 +93,17 @@ sub delempty { 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 @@ foreach $line (@data) { 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;
}
|