Re: Question about \uxxxx etc. for 21-bit code points - need advice

From: Doug Ewell (
Date: Wed May 24 2000 - 09:49:19 EDT


Marco Cimarosti <> wrote:

> And this is precisely what I am not confortable with, because it makes
> escape sequences ambiguous. Take for example "\x2Two": it expands to
> { 2, 'T', 'w', 'o', 0 }. But if you translate the "Two" in French, you
> get "\x2Deux" that expands to { 45, 'e', 'u', 'x', 0 }...

You get around this problem in C by putting the escape sequence in a
separate literal string from the following text and writing the two
literal strings together, like this:

    "\x2" "Two"
    "\x2" "Deux"

The break between literal strings tells the compiler that the escape
sequence is over, but the strings are still concatenated.

You can also get this effect by defining a constant:

    #define TWO "\x2"

and then you can say:

    TWO "Two" or TWO "Deux"

This is just like using more parentheses in a C arithmetic expression
than strictly necessary; it becomes second nature.

Of course, a properly internationalized program wouldn't have hardcoded
literal strings like "Two" and "Deux" anyway.... :)


-Doug Ewell
 Fullerton, California

This archive was generated by hypermail 2.1.2 : Tue Jul 10 2001 - 17:21:03 EDT