in reply to Re^5: A UTF8 round trip with MySQL
in thread A UTF8 round trip with MySQL
No, because the string isn't in utf8 but in the default 8bit encoding.Sorry, that should have been $string = Encode::decode('iso-8859-1',$string)
From the Encode docs:
the UTF8 flag for $string is on unless $octets entirely consists of ASCII data (or EBCDIC on EBCDIC machines).
However, that wouldn't work for $string = 'ρα'; without a preceeding use utf8; because it would, by default be stored internally as Latin-1, and here you would need to utf8::upgrade($string).
From the perlunicode docs:
By default, there is a fundamental asymmetry in Perl's unicode model: implicit upgrading from byte strings to Unicode strings assumes that they were encoded in *ISO 8859-1 (Latin-1)*, but Unicode strings are downgraded with UTF-8 encoding. This happens because the first 256 codepoints in Unicode happens to agree with Latin-1.
Have I got this right?
Clint
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^7: A UTF8 round trip with MySQL
by Joost (Canon) on Jun 13, 2007 at 12:07 UTC |