Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: work with unicode data and regexps

by dakkar (Hermit)
on Feb 11, 2003 at 15:49 UTC ( #234426=note: print w/replies, xml ) Need Help??


in reply to work with unicode data and regexps

open FILE,'<:UTF-16','../perl/testproto/Protokoll.log')

or

binmode FILE,':UTF-16'

If you know the encoding of the file, you can tell Perl what it is, and it will act accordingly. Otherwise, it assumes it is 1 byte = 1 character, and fail on several multi-byte (or variable-length) encodings.

Note: I wrote UTF-16 above since you said you got 'NULs after every character'. You should check if it is indeed UTF-16, or maybe UCS-2 (they're not the same, you know...), or even something else.

-- 
        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://234426]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (5)
As of 2022-05-25 20:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (90 votes). Check out past polls.

    Notices?