Re: Unicode String literals on various platforms

From: Kenneth Whistler (
Date: Thu Aug 03 2000 - 12:53:54 EDT

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,

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

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.


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