in reply to Re^2: How to check the encoding format of an XML
in thread How to check the encoding format of an XML
They are in UCS-2LE but I need to have them in UTF-8 or ANSI.
perl -pe' BEGIN { binmode STDIN, ":raw:perlio:encoding(UTF-16le)"; binmode STDOUT, ":raw:perlio:encoding(UTF-8)"; } ' < file.xml > file.utf8.xml
(UTF-16le is a superset of UCS-2le, so it's safer to use it when decoding.)
Update: Note that this doesn't fix the encoding= attribute of the <?xml?> directive. But it sounds like your trying to make the encoding match it anyway.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: How to check the encoding format of an XML
by Anonymous Monk on May 03, 2010 at 09:00 UTC |