Bob Jones asked:

> In a C program, how do you code Unicode string literals on the following
> platforms:
> NT
> Unix (Sun, AIX, HP-UX)
> AS/400
>

A somewhat cumbersome, but completely reliable crossplatform way to
code occasional Unicode string literals in a C program is: 

static unichar thai2[] = {0x0E40,0x0E02,0x0E17,0x0E32,0x0E49,0x0E1B,0x0E07,
                0x0E1C,0x0E33,UNINULL};


where "unichar" is typedef'ed to an unsigned short (i.e. an unsigned 16-bit
integer).

This form of initialization of Unicode strings in C works on all platforms,
including the EBCDIC ones.

Of course, if you have to deal with lots of Unicode string literals, then you
may be better off coding some kind of a resource compiling system, and then
referring to the string literals by a system of id's, so that you don't
end up cluttering your code with lots of static array declarations that
may be difficult to maintain.

--Ken

Reply via email to