On Wed, 26 Jun 2013 12:36:01 +1200, Gregory Machin wrote:
>
>Looks like the data already is utf8, but the header of the XML
>specifies otherwise.
>How do you parse the data? Can you give us a short example file?
>
>Jenda
This is a bit of code I adapt to whichever encoding I require.

use open ":encoding(UTF-16le)";
while( <> ) {
        s/\x{FF}\x{FE}|\x{FFFF}//;              # Remove BOM.
        s/[\x0A\x0D]+$//;                       # Remove CR LF

If you can get the data into a text editor which has a "convert" option,
you can use it to either find out the encoding &/or change it to utf8.
If you have a file with mixed encodings, you have my sympathies.

--
Peter Gordon, pete...@netspace.net.au on 06/26/2013



--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to