Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^2: UTF-16 on WinXP written by Perl shows whitespaces.

by almut (Canon)
on Nov 07, 2007 at 13:40 UTC ( #649481=note: print w/replies, xml ) Need Help??


in reply to Re: UTF-16 on WinXP written by Perl shows whitespaces.
in thread UTF-16 on WinXP written by Perl shows whitespaces.

open IN, '<:raw:encoding(UTF-16LE)', $ARGV[ 0 ]; open OUT, '>:raw:encoding(UTF-16LE)', $ARGV[ 0 ] . '.modified';

For text files, I'd suggest using :raw:encoding(UTF-16LE):crlf:utf8 instead, in which case Perl will do proper linefeed translations (on Windows), just like it would without the :encoding(UTF-16LE).  Otherwise, be prepared to handle trailing carriage returns (\r) yourself — chomp (with the default $/ setting), for example, will not remove them...

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (8)
As of 2021-06-25 13:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What does the "s" stand for in "perls"? (Whence perls)












    Results (136 votes). Check out past polls.

    Notices?