The stupid question is the question not asked | |
PerlMonks |
Re: Unicode strangenessby graff (Chancellor) |
on Oct 15, 2005 at 22:14 UTC ( [id://500506]=note: print w/replies, xml ) | Need Help?? |
pg is right. I don't have a windows machine to try it on, but it would seem that when you use the mode spec ">:encoding(ucs2le)" in the open call, this might get appended after the default Windows ":crlf" mode.
Another way to try would be one of the following (I'm not sure which because again, I don't have a windows box to try it on):
In either case, by putting ":crlf" after the encoding spec, the crlf layer (converting "\n" in your code to "\r\n" on output) will create proper 16-bit renderings of the CR and LF characters (0d 00 0a 00). It does seem unfortunate that this is not the default behavior. (updated to fix spelling error in code sample)
In Section
Seekers of Perl Wisdom
|
|