in reply to What does Encode::encode_utf8 do to UTF-8 data ?
AFAICS it merely removes the UTF-8 flag, as the program below seems to demonstrateYes,and that's what it's supposed to do.
$a is a string containing 1 character, which happens to have a utf8 representation that takes two octets; $b is is string containing 2 characters, which represent each of the octets of $a's utf8 representation.use strict; use warnings; use Encode; $a = "\x{100}"; $b = Encode::encode_utf8($a); print "a = ", join(',', map ord($_), split //, $a), "\n"; print "b = ", join(',', map ord($_), split //, $b), "\n"; __END__ $ perl /tmp/p a = 256 b = 196,128 $
PS your if statement has the wrong logic; it prints "differ" when eq matches.
Dave.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: What does Encode::encode_utf8 do to UTF-8 data ?
by scollyer (Sexton) on Oct 03, 2005 at 12:32 UTC | |
by dave_the_m (Monsignor) on Oct 03, 2005 at 13:27 UTC | |
by scollyer (Sexton) on Oct 03, 2005 at 13:59 UTC | |
by dave_the_m (Monsignor) on Oct 03, 2005 at 14:56 UTC | |
by scollyer (Sexton) on Oct 03, 2005 at 16:08 UTC | |
| |
by scollyer (Sexton) on Oct 03, 2005 at 13:36 UTC |