c - Source code defined wide char strings and cross-platform -
under visual studio source-code-defined strings l"abc"
result c-string 2-bytes wide chars.
- what linux compilers ? possible use l"" syntax ?
- if yes, chars of c-string linux wide chars (i.e 4-bytes wide) ?
- is there "cross-compiler" way define ucs-2 or utf-16 encoded unicode strings ?
thank you. :)
edit : forgot mention can't use c++11.
there no cross-platform way conveniently write utf-16 string literals without using @ least c11 or c++11 (where can use u"..."
).
the wide string syntax (l"..."
) creates const wchar_t*
using implementation-defined encoding. on windows, encoding utf-16; gcc (using gnu's libc), encoding utf-32.
the safe , portable way create utf-16—or utf—strings (pre-c11/c++11) write them integer arrays. example:
const uint16_t str[] = { 0x24ea, 0x0 };
Comments
Post a Comment