[Expat-discuss] XML_UNICODE_WCHAR_T Ineffective

Allen, Michael B (RSCH) Michael_B_Allen@ml.com
Tue, 3 Jul 2001 17:51:25 -0400


Hi,

The XML_UNICODE_WCHAR_T define doesn't seem to be working for me. My
build is:

gcc -Wall -I include -L lib -lmba \ 
        -lexpat -DXML_UNICODE_WCHAR_T -o x0.o x0.c

which compiles without type warnings(whereas without
-DXML_UNICODE_WCHAR_T I do get a type warning about using wchar_t in
the code) but my end tag handler:

void
end(void *userData, const wchar_t *name)
{
  log_hexdump(NORM, (const char *)name, 0, 16, 16, "hexdump of name\n");
  log(NORM, "end called %s\n", name);
}

produces the following:

x0.c:15: hexdump of name 
00000:  75 73 65 72 00 00 69 64 00 00 61 75 74 68 00 00  |user..id..auth..|
x0.c:16: end called user

Notice if this where wchar_t characters the hexdump function(which just
blindly prints the hex values of a region of memory) would show three
zeros in between each ASCII equivalent hex code and the %ls printf format
specifier does not work -- must use %s instead.

Is this a bug or am I doing something wrong?

Linux 2.2.14 i686
glibc-2.1.3-15
expat-1.95.1

Thanks,
Mike