algebraicthunk.net/ blog/ entry/ Curses! ... WIDE curses.

Over the last couple weeks, I've been discovering that the business of writing wide-character programs that use curses is almost completely undocumented. I'm trying to figure this out because there are apparently some people who seem to like utf8, and I want them to stop bothering me :-). I was wondering if anyone out there has experience getting ncurses to play nicely with Unicode (or, I suppose, other wide character) locales, and if so, if there's any standard documentation that I could be pointed at. The ncurses manpages have some general information, but they're missing key details (for instance, what are the precise semantics of getcchar/setcchar, and what character encoding should I be passing into them?), and it looks like I'll probably have to dig through the library code to get real answers. sigh...

[UPDATE] the library code reveals that my worst fears are realized. getcchar/setcchar operate on whole strings. But, you see, they only let you pass in a single attribute/color value. So despite the fact that you're supposedly manipulating attributes combined with text (like chtype), you're actually unable to do anything more complicated than set the attributes of a whole string at once -- or carefully feed your data to curses one character at a time, generating pointless single-character strings to do so! Ewwwwwwwwwwwwwwwwwwwwwwwwwwwwwww.

[UPDATE 2] In the previous update, I somehow missed the prominent usages of CCHARWMAX in getcchar() and setcchar(). setcchar errors out if there are more than CCHARWMAX characters in the string, and getcchar never copies more than CCHARWMAX characters from its input cchart to the output. (there seems to be some funny business going on with the number of wchar_t values in the string vs wcslen, but I could well just be confused)