
b4swine
New User

Oct 9, 2006, 10:41 AM
Post #1 of 1
(6719 views)
|
unicode utf-16le CR-LF problem
|
Can't Post
|
|
When you output utf-16, every char should be 2 (or perhaps 4 bytes long). But if any of the 16-bit chars contains a \x0a byte, that LF will be expanded to a CR-LF, destroying all unicodicity. Can't figure out how to do 'binary mode' output with unicode. Help!
$_ = "\x{ff0a}\x{1234}"; open OUT, ">temp.txt"; binmode OUT, ":encoding(UTF-16le)"; print OUT; close OUT; # The output file contains five bytes: 0D 0A FF 34 12
|