[cfe-dev] C99/C++ UCN (Universal Character Name) Support

Eli Friedman eli.friedman at gmail.com
Fri Mar 27 18:02:37 PDT 2009


On Fri, Mar 27, 2009 at 5:45 PM, steve naroff <snaroff at apple.com> wrote:
> Part of implementing this is converting UTF-16 (\u) and UTF-32 (\U) to
> UTF-8 (for insertion into a C-string, say).

It's not very hard; one version of the formula is available at
http://en.wikipedia.org/wiki/UTF-8.  And UTF-16 isn't really relevant
here; \u denotes a Unicode code point, not a UTF-16 code unit.

> Unfortunately, Unix doesn't appear to have any standard support for
> this type of conversion (which surprised me).

You could use iconv, although that's overkill here...

-Eli



More information about the cfe-dev mailing list