SPUG: weired windows fonts (encoding(utf16))

David Dyck david.dyck at fluke.com
Thu Nov 20 14:19:55 CST 2003


On Thu, 20 Nov 2003 at 07:21 -0800, David Dyck <david.dyck at fluke.com> wrote:

> On Thu, 20 Nov 2003 at 00:16 -0800, Florentin Ionescu <florentin_ionescu at ya...:
> > On windows XP , I encounter something strange - a file
> > that contains, say a line
> > [ this line ]
> > is red by perl something like this
> > [ t h i s  l i n e ].
> >
> > Does anybody please know/has idea on what goes wrong ?

> The file is encoded in windows unicode format
> If you create a file in notepad.exe and save it
> using "save as" and set the Encoding to Unicode
> you can create such a file as my foo.txt
> perl will print it like this

> $ perl -ple '' foo.txt
> ÿ_t h i s   i s   f o o . t x t

I really should have added that if you use perl 5.8 you can use
perl5.8 -lwe "open FH, q(<:encoding(utf16)), q(foo.txt); while (<FH>) { print }"
and get
This is foo.txt



More information about the spug-list mailing list