Hi Takao,

Thanks for the advice, I tried UCS-4LE and it works on Solaris.

I have a question, are you suggesting I change it to this for all 
platforms, or just for Sun Solaris:?

     return Glib::convert(std::string(reinterpret_cast<const char 
*>(str.data()),
                      str.size() * sizeof(wchar_t)),
              "UTF-8", "UCS-4LE");

Thanks,
Mark


Takao Fujiwara wrote:
> (08/28/09 05:25), Mark Logan-san wrote:
>> +#ifdef __sun
>> +    return std::string(reinterpret_cast<const char *>(str.data()), 
>> str.size());
>> +#else
>>      return Glib::convert(std::string(reinterpret_cast<const char 
>> *>(str.data()),
>>                       str.size() * sizeof(wchar_t)),
>>               "UTF-8", "WCHAR_T");
>> +#endif
>
> I'd recommend to use "UCS-4LE" instead of "WCHAR_T" for x86.
> You could check the behavior with iconv command.
> % iconv -f UTF-8 -t UCS-4LE utf8.txt > ucs4.txt
>
> mbstowcs() is also available.


Reply via email to