// ----------------------------------------------------------------------------
// the config paths we use
// ----------------------------------------------------------------------------
// the config paths we use
static const wxChar* FONTMAPPER_CHARSET_PATH = wxT("Charsets");
static const wxChar* FONTMAPPER_CHARSET_ALIAS_PATH = wxT("Aliases");
#if wxUSE_GUI
static const wxChar* FONTMAPPER_CHARSET_PATH = wxT("Charsets");
static const wxChar* FONTMAPPER_CHARSET_ALIAS_PATH = wxT("Aliases");
#if wxUSE_GUI
- wxTRANSLATE( "West European (ISO-8859-1/Latin 1)" ),
- wxTRANSLATE( "Central European (ISO-8859-2/Latin 2)" ),
+ wxTRANSLATE( "Western European (ISO-8859-1)" ),
+ wxTRANSLATE( "Central European (ISO-8859-2)" ),
wxTRANSLATE( "Esperanto (ISO-8859-3)" ),
wxTRANSLATE( "Baltic (old) (ISO-8859-4)" ),
wxTRANSLATE( "Esperanto (ISO-8859-3)" ),
wxTRANSLATE( "Baltic (old) (ISO-8859-4)" ),
wxTRANSLATE( "Arabic (ISO-8859-6)" ),
wxTRANSLATE( "Greek (ISO-8859-7)" ),
wxTRANSLATE( "Hebrew (ISO-8859-8)" ),
wxTRANSLATE( "Turkish (ISO-8859-9)" ),
wxTRANSLATE( "Nordic (ISO-8859-10)" ),
wxTRANSLATE( "Thai (ISO-8859-11)" ),
wxTRANSLATE( "Arabic (ISO-8859-6)" ),
wxTRANSLATE( "Greek (ISO-8859-7)" ),
wxTRANSLATE( "Hebrew (ISO-8859-8)" ),
wxTRANSLATE( "Turkish (ISO-8859-9)" ),
wxTRANSLATE( "Nordic (ISO-8859-10)" ),
wxTRANSLATE( "Thai (ISO-8859-11)" ),
- wxTRANSLATE( "ISO-8859-14" ),
- wxTRANSLATE( "West European new (ISO-8859-15/Latin 0)" ),
+ wxTRANSLATE( "Celtic (ISO-8859-14)" ),
+ wxTRANSLATE( "Western European with Euro (ISO-8859-15)" ),
wxTRANSLATE( "Windows Greek (CP 1253)" ),
wxTRANSLATE( "Windows Turkish (CP 1254)" ),
wxTRANSLATE( "Windows Hebrew (CP 1255)" ),
wxTRANSLATE( "Windows Arabic (CP 1256)" ),
wxTRANSLATE( "Windows Baltic (CP 1257)" ),
wxTRANSLATE( "Windows/DOS OEM (CP 437)" ),
wxTRANSLATE( "Windows Greek (CP 1253)" ),
wxTRANSLATE( "Windows Turkish (CP 1254)" ),
wxTRANSLATE( "Windows Hebrew (CP 1255)" ),
wxTRANSLATE( "Windows Arabic (CP 1256)" ),
wxTRANSLATE( "Windows Baltic (CP 1257)" ),
wxTRANSLATE( "Windows/DOS OEM (CP 437)" ),
size_t count = WXSIZEOF(gs_encodingDescs);
wxASSERT_MSG( count == WXSIZEOF(gs_encodings),
size_t count = WXSIZEOF(gs_encodingDescs);
wxASSERT_MSG( count == WXSIZEOF(gs_encodings),
size_t count = WXSIZEOF(gs_encodingNames);
wxASSERT_MSG( count == WXSIZEOF(gs_encodings),
size_t count = WXSIZEOF(gs_encodingNames);
wxASSERT_MSG( count == WXSIZEOF(gs_encodings),
- else if ( cs == wxT("KOI8-R") || cs == wxT("KOI8-U") )
+ }
+ else if ( cs == wxT("UTF-7") )
+ {
+ encoding = wxFONTENCODING_UTF7;
+ }
+ else if ( cs == wxT("UTF-8") )
+ {
+ encoding = wxFONTENCODING_UTF8;
+ }
+ else if ( cs == wxT("KOI8-R") ||
+ cs == wxT("KOI8-U") ||
+ cs == wxT("KOI8-RU") )
+ {
+ // although koi8-ru is not strictly speaking the same as koi8-r,
+ // they are similar enough to make mapping it to koi8 better than
+ // not reckognizing it at all
else if ( cs.Left(3) == wxT("ISO") )
{
// the dash is optional (or, to be exact, it is not, but
else if ( cs.Left(3) == wxT("ISO") )
{
// the dash is optional (or, to be exact, it is not, but
- int value;
- if ( wxSscanf(cs.c_str() + 8, wxT("%u"), &value) == 1 )
+ size_t len;
+ if ( cs.Left(7) == wxT("WINDOWS") )
+ {
+ len = 7;
+ }
+ else if ( cs.Left(2) == wxT("CP") )
+ {
+ len = 2;
+ }
+ else // not a Windows encoding
+ {
+ len = 0;
+ }
+
+ if ( len )
- // a valid Windows code page
- value += wxFONTENCODING_CP1250;
- encoding = (wxFontEncoding)value;
+ value -= 1250;
+ if ( value < wxFONTENCODING_CP12_MAX -
+ wxFONTENCODING_CP1250 )
+ {
+ // a valid Windows code page
+ value += wxFONTENCODING_CP1250;
+ encoding = (wxFontEncoding)value;
+ }
// now try the default mappings:
wxFontEncodingArray equiv = wxEncodingConverter::GetAllEquivalents(encoding);
size_t count = equiv.GetCount();
// now try the default mappings:
wxFontEncodingArray equiv = wxEncodingConverter::GetAllEquivalents(encoding);
size_t count = equiv.GetCount();
- if ( TestAltEncoding(configEntry, equiv[i], info) )
- return TRUE;
+ for ( size_t i = (equiv[0] == encoding) ? 1 : 0; i < count; i++ )
+ {
+ if ( TestAltEncoding(configEntry, equiv[i], info) )
+ return TRUE;
+ }