in reply to newline in unicode under windows

There is a bug in the UTF-16 and CRLF filters. The CRLF filters, which adds the CR on Windows, works with bytes and happens after the UTF-16 encoding. It ends up putting in a 0x0D byte instead of 0D 00 bytes for the encoding.

One solution is to remove the crlf layer.

open(my $fh, ">:raw", $file); binmode($fh, ":encoding(ucs2le)"); print $fh, "\r\n";
Another is to put the crlf before the ucs2le encoding, but I am not sure how to do that.

Replies are listed 'Best First'.
Re^2: newline in unicode under windows
by snaporaz (Acolyte) on Jul 12, 2004 at 22:15 UTC
    Thanks for the heads up on the bug. And your solution worked for me. Thanks!
Re^2: newline in unicode under windows
by ysth (Canon) on Jul 13, 2004 at 01:56 UTC
    Unfortunately, AFAICT this isn't going to be fixed for 5.8.5. Though it was reported by activestate, so it's possible they might have come up with a fix for ActivePerl that didn't get submitted back upstream.