in reply to Decoding UTF-8 - "Cannot decode string with wide characters"
As you said, your strings seems to be allready in unicode. They seem to be allready sequences of unicode characters and are certainly marked as unicode/utf8 within perl. You can check that with utf8::is_utf8($string) (that should be true in your case).
So there's no point decoding them again within perl.
decode works on sequence of bytes, not on sequence of characters, and here you got a sequence of unicode characters.
I guess what you like to do is print your strings in a UTF-8 terminal. To do so, you simply have to either:
Hope it helps. unicode/utf8 are often quite confusing.
The confusion comes from mixing unicode and utf8 concepts. Unicode is a standard for universal character representation. You can view it as the format of internal strings in perl when an input string needs that kind of characters. So a string of unicode character is a string of characters.
utf8 is a _way_ to encode unicode strings. A utf8 string is a string of bytes, and should be used exclusively for I/O. encode_utf8($string) transforms an internal perl string (unicode or not) into a sequence of utf8 bytes. decode_utf8($string) transforms a sequence of utf8 bytes into a unicode internal perl string.
-- Nice photos of naked perl sources here !
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Decoding UTF-8 - "Cannot decode string with wide characters"
by shmem (Chancellor) on Aug 25, 2006 at 14:25 UTC |