Just now I have run into an issue with my mail screener and the charset gb1830. An incoming message has some fields encoded in GB1830 and I am trying to use code such as
Code: Select all
wxFontEncoding text_encoding = wxFontMapper::Get()->CharsetToEncoding(char_set);
wxFontEncoding system_encoding = wxLocale::GetSystemEncoding();
wxFontEncoding fontenc = wxFontMapper::Get()->CharsetToEncoding(char_set);
if ( fontenc == wxFONTENCODING_SYSTEM )
{
wxLogError(wxT("Charset '%s' is unsupported."), char_set.c_str());
return str;
}
wxEncodingConverter converter;
bool can_convert = converter.Init(text_encoding, system_encoding);
if (can_convert)
{
str_content = converter.Convert(str);
}
The string char_set is "gb1830' and the call to Get()->CharsetToEncoding(char_set) returns wxFONTENCODING_ISO8859_1 instead of wxFONTENCODING_SYSTEM, implying that the character set is supported, but enum wxFontEncoding does not include any such character set and of course,the decoded string is all wrong.
What am I missing.
TIA