Re: Continuing Perl 5.8.0 Problems
by Petr Pajas other posts by this author
Oct 2 2002 4:05PM messages near this date
view in the new Beta List Site
Re: Continuing Perl 5.8.0 Problems
|
Re: Continuing Perl 5.8.0 Problems
Steve Hay <steve.hay@[...].com> writes:
> Thus,
>
> $str = decode('utf8', $str);
no, I hope I wrote this is supposed to read the UTF-8 encoded octet,
check if it is a valid UTF-8 encoded string and turn the UTF8 flag ON.
if you want to turn it OFF for a UTF-8 encoded string, you simply use
$str = encode('utf8', $str);
It takes the input string with UTF-8 flag on and "encodes" it into a
UTF-8 octet, which effectively means that it only takes the UTF-8
flag out.
I think the names encode and decode are little bit confusing, until
one gets used to them. Think of it in this way: Perl 5.8 is a stranger
who pretends only to understand UTF-8 encoded (and UTF-8 flagged)
strings. So this Perl guy has to "decode" strings that are not flagged
to understand them as unicode; he can "encode" UTF-8 flagged strings
to any other encoding dialect for the outer world.
-- Petr
_______________________________________________
Perl-XML mailing list
Perl-XML@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Thread:
Steve Hay
Steve Hay
Robin Berjon
Steve Hay
Petr Pajas
Robin Berjon
Steve Hay
Petr Pajas
|