Re: join("") somehow changes characters after 'z'
- From: "Peter J. Holzer" <hjp-usenet2@xxxxxx>
- Date: Wed, 10 Oct 2007 20:52:17 +0200
On 2007-10-09 21:13, Ben Morrow <ben@xxxxxxxxxxxx> wrote:
Perl doesn't know what character encoding you are expecting on STDOUT.
As a result, it is printing the raw bytes of its own internal
representation,
No, it isn't. It prints strings which contain only characters
in the range [0 .. 255] as 1 byte per character, and strings which
contain characters outside of this range as 1 utf8 sequence per
character. This is independent of how the strings are represented
internally. Consider this:
#!/usr/bin/perl
use utf8;
my $x = "\x{B0}";
utf8::upgrade($x);
print STDERR utf8::is_utf8($x) ? "wide\n" : "byte\n";
print $x;
__END__
% ./foo | od -tx1
wide
0000000 b0
0000001
After the upgrade, $x is internally represented as a wide string (as can
be seen from the output "wide" on STDERR), put it still prints only one
byte to STDOUT.
hp
--
_ | Peter J. Holzer | I know I'd be respectful of a pirate
|_|_) | Sysadmin WSR | with an emu on his shoulder.
| | | hjp@xxxxxx |
__/ | http://www.hjp.at/ | -- Sam in "Freefall"
.
- Follow-Ups:
- Re: join("") somehow changes characters after 'z'
- From: Ben Morrow
- Re: join("") somehow changes characters after 'z'
- References:
- join("") somehow changes characters after 'z'
- From: Paul Lalli
- Re: join("") somehow changes characters after 'z'
- From: Ben Morrow
- join("") somehow changes characters after 'z'
- Prev by Date: www.yedil.com best hindi entertainment site
- Next by Date: FAQ 5.6 How do I make a temporary file name?
- Previous by thread: Re: join("") somehow changes characters after 'z'
- Next by thread: Re: join("") somehow changes characters after 'z'
- Index(es):
Relevant Pages
|