My two penneth ...
> u"abc"
That's an ugly microsoft style syntax.
This actually reminds me of the old style pointer problems when a "char*"
wasn't the same as an "int*"; so I would propose a syntax based on the
casting:
typedef __builtin_utf16_t utf16_t;
#define u (utf16_t*)
utf16_t funnystring[] = u"Hello world";
#define U(str) ((utf16_t*)(str))
utf16_t funnystring[] = U("Hello world");
The text string is in the current locale as specified by the environment.
(ie UTF-8)
It's then a general solution for UTF-8, UCS-4 and any other character set
given the correct __builtin type.
NB: A cast is not normally a valid initiliser for an array.
For C++ it could also be extended/adjusted to call specific cast operators
for conversions that need to be done at runtime.
--
Rob. (Robert de Bath <robert$ @ debath.co.uk>)
<http://www.cix.co.uk/~mayday>
-
Linux-UTF8: i18n of Linux on all levels
Archive: http://mail.nl.linux.org/linux-utf8/