Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Re: Re: reading unicode files

by dakkar (Hermit)
on Mar 13, 2003 at 15:18 UTC ( #242706=note: print w/replies, xml ) Need Help??


in reply to Re: Re: reading unicode files
in thread reading unicode files

The easiest (for me) way to decide if your file is utf-16 or ucs-2 (see below) is to look at it, using something like:

C:\> more < thefile
If you see something (like smileys, or whitespace) between each latin letter, it's either of the two encodings above, otherwise it isn't (this assumes you have latin letters in your file)

To read them: (I was not very clear)

open FILE,'<:encoding(utf-16)','filename';
or whatever encoding you want. The :utf8 spec is a sort of shorthand for the full :encoding() spec...

ucs-2 is a degenerate form of Unicode encoding, since it can not represent character beyond the first 2^16. It is more-or-less compatible with utf-16 for those, so you might not notice the difference. Anyway, don't use to write new files (please ;-) )

-- 
        dakkar - Mobilis in mobile

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2022-05-24 19:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (84 votes). Check out past polls.

    Notices?