id summary reporter owner description type status priority milestone component version severity resolution keywords cc 4135 CPLRecodeFromWCharIconv() does not work properly if wchar_t is 4bytes warmerdam warmerdam "If a source encoding of CPL_ENC_UCS2 (or CPL_ENC_UTF16) is used with CPLRecodeFromWChar() and the call is passed to the iconv implementation then it will not work properly. iconv() itself deduces the character size from the source encoding, but when working with wchar_t the character size should be determined based on the size of wchar_t instead of the encoding. That is, it should be ok to use CPL_ENC_UTF16 even when the characters are held in 32bit wchar_t's. The solution, I believe, is to translate the wchar_t's into a 16bit buffer within the iconv implementation. It would be ideal if there was a way of asking iconv the character size for a particular encoding. For that matter, it should be acceptable to use CPL_ENC_UTF8 in wchar_t buffers! Note that the iconv() support was not present in 1.8 so this is a trunk-only issue. " defect closed normal default svn-trunk normal fixed recode dron