I'm trying to write some C code which is portable only so far as the user has gcc
, and has glib
installed.
From all my research, I've found that with gcc
, a wchar_t
is always defined as 4 bytes, and with glib
a gunichar
is also 4 bytes.
What I haven't figured out is if like a gunichar
, a wchar_t
is encoded as UCS4 as well. Is this the case? If so, I should be able to simply cast a gunichar*
to a wchar_t*
and use the stdc wcs*
functions, right?
If you use GLib, don't use wchar_t
. Use its unicode support, it's a lot better than the C standard library's support.
wchar_t
is 4 bytes on Linux and Mac OS (and a few others), not on Windows (it's 2 bytes there) and some others. Portable code means avoiding wchar_t
like the plague.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With