Hi,
I'm using Perl 5.8.3 and are a bit stumped by the following problem.
I'm reading in a UTF-16 encoded file and writing it out as a utf8 encoded
file.
Everything seems to work fine, except that the line ends double.
I really can not see why?
The UTF-16 input file looks in hex like:
FF FE 3C 00 3F 00 ... 3F 00 3E 00 0D 00 0A 00 ...
Or in human language:
<?xml...?>'return'
The utf8 I get out is:
3C 3F 78 ...3F 3E 0D 0D 0A
And it is this 0D 0D 0A sequence that keeps coming back for every return in
the input file.
The simple program looks like:
#/usr/bin/perl -w
use Encode;
my $inFile = "utf-16.txt";
my $outFile = "utf-8.txt";
my $content;
open IN, "<:encoding(UTF-16)", $inFile;
open OUT, ">:encoding(utf8)", $outFile;
while (<IN>) {
s#encoding="utf-16"#encoding="utf-8"#;
print OUT "$_";
};
close IN;
close OUT;
print "Done";
Kind Regards,
Bart
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs