Added GB2312, BIG5, EUC-JP and Shift-JIS encodings to

known encodings so that message catalogs written in
    these encodings can be loaded. I did't find the code
    where I can specify that GB2312 is actually the same
    as the Windows code page.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@17627 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
2002-10-24 23:15:36 +00:00
parent 7fb7ed97e9
commit f481b72d90
3 changed files with 44 additions and 0 deletions

View File

@@ -45,6 +45,14 @@ enum wxFontEncoding
wxFONTENCODING_ALTERNATIVE, // same as MS-DOS CP866 wxFONTENCODING_ALTERNATIVE, // same as MS-DOS CP866
wxFONTENCODING_BULGARIAN, // used under Linux in Bulgaria wxFONTENCODING_BULGARIAN, // used under Linux in Bulgaria
// Chinese
wxFONTENCODING_GB2312, // Simplified Chinese (same as CP936)
wxFONTENCODING_BIG5, // Traditional Chinese (same as CP950)
// Japanese (see http://zsigri.tripod.com/fontboard/cjk/jis.html)
wxFONTENCODING_SHIFT_JIS, // (same as CP932)
wxFONTENCODING_EUC_JP, // Extended Unix Codepage for Japanese
// what would we do without Microsoft? They have their own encodings // what would we do without Microsoft? They have their own encodings
// for DOS // for DOS
wxFONTENCODING_CP437, // original MS-DOS codepage wxFONTENCODING_CP437, // original MS-DOS codepage

View File

@@ -88,6 +88,10 @@ static wxFontEncoding gs_encodings[] =
wxFONTENCODING_ISO8859_13, wxFONTENCODING_ISO8859_13,
wxFONTENCODING_ISO8859_14, wxFONTENCODING_ISO8859_14,
wxFONTENCODING_ISO8859_15, wxFONTENCODING_ISO8859_15,
wxFONTENCODING_GB2312,
wxFONTENCODING_BIG5,
wxFONTENCODING_SHIFT_JIS,
wxFONTENCODING_EUC_JP,
wxFONTENCODING_KOI8, wxFONTENCODING_KOI8,
wxFONTENCODING_CP932, wxFONTENCODING_CP932,
wxFONTENCODING_CP936, wxFONTENCODING_CP936,
@@ -125,6 +129,10 @@ static const wxChar* gs_encodingDescs[] =
wxTRANSLATE( "Celtic (ISO-8859-14)" ), wxTRANSLATE( "Celtic (ISO-8859-14)" ),
wxTRANSLATE( "Western European with Euro (ISO-8859-15)" ), wxTRANSLATE( "Western European with Euro (ISO-8859-15)" ),
wxTRANSLATE( "KOI8-R" ), wxTRANSLATE( "KOI8-R" ),
wxTRANSLATE( "Chinese Simplified (GB2312)" ),
wxTRANSLATE( "Chinese Traditional (BIG5)" ),
wxTRANSLATE( "Japanese (Shift-JIS)" ),
wxTRANSLATE( "Extended Unix Codepage for Japanese (EUC-JP)" ),
wxTRANSLATE( "Windows Japanese (CP 932)" ), wxTRANSLATE( "Windows Japanese (CP 932)" ),
wxTRANSLATE( "Windows Chinese Simplified (CP 936)" ), wxTRANSLATE( "Windows Chinese Simplified (CP 936)" ),
wxTRANSLATE( "Windows Korean (CP 949)" ), wxTRANSLATE( "Windows Korean (CP 949)" ),
@@ -161,6 +169,10 @@ static const wxChar* gs_encodingNames[] =
wxT( "iso-8859-14" ), wxT( "iso-8859-14" ),
wxT( "iso-8859-15" ), wxT( "iso-8859-15" ),
wxT( "koi8-r" ), wxT( "koi8-r" ),
wxT( "gb2312" ),
wxT( "big5" ),
wxT( "shift-jis" ),
wxT( "euc-jp" ),
wxT( "windows-932" ), wxT( "windows-932" ),
wxT( "windows-936" ), wxT( "windows-936" ),
wxT( "windows-949" ), wxT( "windows-949" ),
@@ -521,6 +533,25 @@ wxFontEncoding wxFontMapper::CharsetToEncoding(const wxString& charset,
{ {
encoding = wxFONTENCODING_UTF8; encoding = wxFONTENCODING_UTF8;
} }
else if ( cs == wxT("GB2312") )
{
encoding = wxFONTENCODING_GB2312;
}
else if ( cs == wxT("BIG5") )
{
encoding = wxFONTENCODING_BIG5;
}
else if ( cs == wxT("SJIS") ||
cs == wxT("SHIFT_JIS") ||
cs == wxT("SHIFT-JIS") )
{
encoding = wxFONTENCODING_SHIFT_JIS;
}
else if ( cs == wxT("EUC-JP") ||
cs == wxT("EUC_JP") )
{
encoding = wxFONTENCODING_EUC_JP;
}
else if ( cs == wxT("KOI8-R") || else if ( cs == wxT("KOI8-R") ||
cs == wxT("KOI8-U") || cs == wxT("KOI8-U") ||
cs == wxT("KOI8-RU") ) cs == wxT("KOI8-RU") )

View File

@@ -652,6 +652,11 @@ bool wxGetNativeFontEncoding(wxFontEncoding encoding,
info->xencoding = wxT("*"); info->xencoding = wxT("*");
break; break;
case wxFONTENCODING_GB2312:
info->xregistry = wxT("GB2312"); // or the otherway round?
info->xencoding = wxT("*");
break;
case wxFONTENCODING_KOI8: case wxFONTENCODING_KOI8:
info->xregistry = wxT("koi8"); info->xregistry = wxT("koi8");