in reply to Re: Unicode strangeness
in thread Unicode strangeness
Tested on Windows XP. Neither worked. However the thought is definitely very decent. I probably know where your thought came from: in the old days, :raw reverses :crlf, but it no longer does.
use strict; use warnings; use charnames ':full'; open( my $fh, ">:raw:encoding(ucs2le):crlf", "test.plp" ); print $fh "\N{CARRIAGE RETURN}\N{LINE FEED}"; close $fh; #test open(PLP,"<","test.plp"); my $string; sysread(PLP, $string, 100); printf("0x%02x ", ord($_)) for (split //, $string);
This prints:
0x0d 0x00 0x0d 0x00 0x0a 0x00
use strict; use warnings; use charnames ':full'; open( my $fh, ">:encoding(ucs2le):crlf", "test.plp" ); print $fh "\N{CARRIAGE RETURN}\N{LINE FEED}"; close $fh; #test open(PLP,"<","test.plp"); my $string; sysread(PLP, $string, 100); printf("0x%02x ", ord($_)) for (split //, $string);
This prints:
0x0d 0x00 0x0d 0x0a 0x00
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Unicode strangeness
by graff (Chancellor) on Oct 16, 2005 at 02:55 UTC |