unicode question for tcl

Patrick R. Michaud pmichaud at pobox.com
Tue Jun 9 20:21:07 UTC 2009


On Mon, Jun 08, 2009 at 11:54:11PM -0400, Will Coleda wrote:
> The tcl spec test "string.test" fails with:
> 
>   Invalid character for UTF-8 encoding
> 
> This is due to the following tcl test:
> 
> test string-24.5 {string reverse command - shared unicode string} {
>     set x abcde\udead
>     string reverse $x
> } \udeadedcba
> 
> I can't see a way to generate this string (\udead) in parrot, with
> various failures on utf16, utf8, and ucs2.

In my reading of the Unicode specs [1], it looks as though Parrot has
this one correct.  U+DEAD isn't a valid standalone Unicode character -- 
it falls in the U+DC00..U+DFFF range of surrogates; "Surrogates are
reserved for use with UTF-16 and then must be used in pairs."

  [1] http://www.unicode.org/charts/PDF/UDC00.pdf

So, I'd claim that the tcl spectest itself is an invalid
test, at least to the extent that it claims to be following Unicode.
The truth is simply that \udead isn't a valid Unicode character.
(Whether you can get the tcl folks to agree may be a different
matter.)

At any rate, it seems the only encoding for which this can 
possibly work is utf16.  

Pm


More information about the parrot-dev mailing list