Hi! I need to update data in some files that are UTF-16LE BOM files, but I've found that the output files are being corrupted with an extra 0x0D char on every line. How could I avoid this? What am I missing?
#!perl
use strict;
use warnings;
open IN, "<:encoding(UTF-16LE)", "in.xml";
open OUT, ">:encoding(UTF-16LE)", "out.xml";
while (<IN>) {
print OUT $_;
}
close OUT;
close IN;
As it could be seen, there are no chomp, explicit decode, or whatever in the loop, it is just printing what it was read. In the input file, each line ends with the hex sequence 0D-00-0A-00, but in the output the sequence is 0D-00-0D-0A-00, adding one byte.
BTW, I don't want to parse the XML files as such, I'll just map some values based on an external dictionary (using a pre-loaded hash)...
EDIT: typo... Thanks!!!