   Character Encoding for GCC Wide Character Literals/iconv on GNU/Linux
  Hi all,I need to be able to convert from a wide character literal to a buffer of four bytes containing the UTF-8 encoded sequence.  I've been using libiconv on GNU/Linux.My character constants are defined as follows:wchar_t characterToConvert = L'<HAN CHARACTER THAT GAMEDEV.NET DOESN'T SEEM TO RECOGNISE>';I take these constants and point to them with a ``char *'' as iconv() requires.Using the "wchar_t" charset name (as follows) seems not to be working:iconv_t characterDescription = iconv_open ("wchar_t", "UTF-8");Neither UTF-16 nor UTF-32 work, too.I would like to know the character encoding of GCC wide character literals.  How are they encoded?  Or am I doing something incorrect with iconv()?Thanks,Patrick Niedzielski   
  I looked it up when writing my own string library before, and most distros of *nix prefer UTF-32. The literals probably are as well, but sizeof() might be able to shed some light. I've never used the iconv functions, but maybe the input strings are expected to be something else.   ;  Ectara,It would be really nice if they were UTF-32 when stored, because I know the wchar_t variables are 32 bits long.  They could be something else, though, as iconv still seems to work incorrectly when I tell it the input's character set is UTF-32.Thank though,Patrick   ;  Glancing at the documentation, have you tried UTF-32BE or UTF-32LE, depending on your endianness?Also, the function is declared as:iconv_t iconv_open(const char *tocode, const char *fromcode);So if you were to convert the wchar_t literal, wouldn't it be:iconv_t iconv_open("UTF-8", "wchar_t");?;Quote:Also, the function is declared as:iconv_t iconv_open(const char *tocode, const char *fromcode);So if you were to convert the wchar_t literal, wouldn't it be:iconv_t iconv_open("UTF-8", "wchar_t");Heh-heh...thanks!  I guess I overlooked that... (^_^")>It seems to be working now.Cheers,Patrick   