added support for koi8-u

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@26695 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2004-04-10 23:43:49 +00:00
parent 557d6f3247
commit 15ad38c34f
8 changed files with 42 additions and 4 deletions

View File

@@ -91,6 +91,7 @@ All (GUI):
resulting in much better display of scaled images resulting in much better display of scaled images
- Added UpdateSize to wxSplitterWindow to allow layout while hidden - Added UpdateSize to wxSplitterWindow to allow layout while hidden
- implemented Freeze/Thaw() for wxGenericTreeCtrl (Kevin Hock) - implemented Freeze/Thaw() for wxGenericTreeCtrl (Kevin Hock)
- support for KOI8-U encoding added (Yuriy Tkachenko)
wxMSW: wxMSW:

View File

@@ -39,7 +39,8 @@ enum wxFontEncoding
wxFONTENCODING_ISO8859_MAX, wxFONTENCODING_ISO8859_MAX,
// Cyrillic charset soup (see http://czyborra.com/charsets/cyrillic.html) // Cyrillic charset soup (see http://czyborra.com/charsets/cyrillic.html)
wxFONTENCODING_KOI8, // we don't support any of KOI8 variants wxFONTENCODING_KOI8, // KOI8 Russian
wxFONTENCODING_KOI8_U, // KOI8 Ukrainian
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

View File

@@ -425,6 +425,7 @@ void MyFrame::OnEnumerateFamiliesForEncoding(wxCommandEvent& WXUNUSED(event))
wxFONTENCODING_ISO8859_7, wxFONTENCODING_ISO8859_7,
wxFONTENCODING_ISO8859_15, wxFONTENCODING_ISO8859_15,
wxFONTENCODING_KOI8, wxFONTENCODING_KOI8,
wxFONTENCODING_KOI8_U,
wxFONTENCODING_CP1250, wxFONTENCODING_CP1250,
wxFONTENCODING_CP1251, wxFONTENCODING_CP1251,
wxFONTENCODING_CP1252, wxFONTENCODING_CP1252,
@@ -438,6 +439,7 @@ void MyFrame::OnEnumerateFamiliesForEncoding(wxCommandEvent& WXUNUSED(event))
wxT("Greek (ISO-8859-7)"), wxT("Greek (ISO-8859-7)"),
wxT("Western European with Euro (ISO-8859-15)"), wxT("Western European with Euro (ISO-8859-15)"),
wxT("KOI8-R"), wxT("KOI8-R"),
wxT("KOI8-U"),
wxT("Windows Central European (CP 1250)"), wxT("Windows Central European (CP 1250)"),
wxT("Windows Cyrillic (CP 1251)"), wxT("Windows Cyrillic (CP 1251)"),
wxT("Windows Western European (CP 1252)"), wxT("Windows Western European (CP 1252)"),

View File

@@ -412,7 +412,7 @@ static wxFontEncoding
// Cyrillic // Cyrillic
{ {
/* unix */ {wxFONTENCODING_KOI8, wxFONTENCODING_ISO8859_5, STOP}, /* unix */ {wxFONTENCODING_KOI8, wxFONTENCODING_KOI8_U, wxFONTENCODING_ISO8859_5, STOP},
/* windows */ {wxFONTENCODING_CP1251, STOP}, /* windows */ {wxFONTENCODING_CP1251, STOP},
/* os2 */ {STOP}, /* os2 */ {STOP},
/* mac */ {wxFONTENCODING_MACCYRILLIC, STOP} /* mac */ {wxFONTENCODING_MACCYRILLIC, STOP}

View File

@@ -72,6 +72,7 @@ static wxFontEncoding gs_encodings[] =
wxFONTENCODING_ISO8859_14, wxFONTENCODING_ISO8859_14,
wxFONTENCODING_ISO8859_15, wxFONTENCODING_ISO8859_15,
wxFONTENCODING_KOI8, wxFONTENCODING_KOI8,
wxFONTENCODING_KOI8_U,
wxFONTENCODING_CP932, wxFONTENCODING_CP932,
wxFONTENCODING_CP936, wxFONTENCODING_CP936,
wxFONTENCODING_CP949, wxFONTENCODING_CP949,
@@ -115,6 +116,7 @@ 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( "KOI8-U" ),
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)" ),
@@ -158,6 +160,7 @@ 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( "koi8-u" ),
wxT( "windows-932" ), wxT( "windows-932" ),
wxT( "windows-936" ), wxT( "windows-936" ),
wxT( "windows-949" ), wxT( "windows-949" ),
@@ -517,14 +520,17 @@ wxFontMapperBase::NonInteractiveCharsetToEncoding(const wxString& charset)
encoding = wxFONTENCODING_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-RU") ) cs == wxT("KOI8-RU") )
{ {
// although koi8-ru is not strictly speaking the same as koi8-r, // although koi8-ru is not strictly speaking the same as koi8-r,
// they are similar enough to make mapping it to koi8 better than // they are similar enough to make mapping it to koi8 better than
// not reckognizing it at all // not recognizing it at all
encoding = wxFONTENCODING_KOI8; encoding = wxFONTENCODING_KOI8;
} }
else if ( cs == wxT("KOI8-U") )
{
encoding = wxFONTENCODING_KOI8_U;
}
else if ( cs.Left(3) == wxT("ISO") ) else if ( cs.Left(3) == wxT("ISO") )
{ {
// the dash is optional (or, to be exact, it is not, but // the dash is optional (or, to be exact, it is not, but

View File

@@ -77,6 +77,7 @@ wxBEGIN_ENUM( wxFontEncoding )
wxENUM_MEMBER( wxFONTENCODING_ISO8859_15 ) wxENUM_MEMBER( wxFONTENCODING_ISO8859_15 )
wxENUM_MEMBER( wxFONTENCODING_ISO8859_MAX ) wxENUM_MEMBER( wxFONTENCODING_ISO8859_MAX )
wxENUM_MEMBER( wxFONTENCODING_KOI8 ) wxENUM_MEMBER( wxFONTENCODING_KOI8 )
wxENUM_MEMBER( wxFONTENCODING_KOI8_U )
wxENUM_MEMBER( wxFONTENCODING_ALTERNATIVE ) wxENUM_MEMBER( wxFONTENCODING_ALTERNATIVE )
wxENUM_MEMBER( wxFONTENCODING_BULGARIAN ) wxENUM_MEMBER( wxFONTENCODING_BULGARIAN )
wxENUM_MEMBER( wxFONTENCODING_CP437 ) wxENUM_MEMBER( wxFONTENCODING_CP437 )

View File

@@ -586,6 +586,31 @@ static wxUint16 encoding_table__KOI8[128] = {
}; };
/*
* KOI8_U to Unicode recoding table
* based on file mappings/KOI8-U.TXT by Unicode Consortium
*/
static wxUint16 encoding_table__KOI8_U[128] = {
0x2500, 0x2502, 0x250C, 0x2510, 0x2514, 0x2518, 0x251C, 0x2524,
0x252C, 0x2534, 0x253C, 0x2580, 0x2584, 0x2588, 0x258C, 0x2590,
0x2591, 0x2592, 0x2593, 0x2320, 0x25A0, 0x2219, 0x221A, 0x2248,
0x2264, 0x2265, 0x00A0, 0x2321, 0x00B0, 0x00B2, 0x00B7, 0x00F7,
0x2550, 0x2551, 0x2552, 0x0451, 0x0454, 0x2554, 0x0456, 0x0457,
0x2557, 0x2558, 0x2559, 0x255A, 0x255B, 0x0491, 0x255D, 0x255E,
0x255F, 0x2560, 0x2561, 0x0401, 0x0403, 0x2563, 0x0406, 0x0407,
0x2566, 0x2567, 0x2568, 0x2569, 0x256A, 0x0490, 0x256C, 0x00A9,
0x044E, 0x0430, 0x0431, 0x0446, 0x0434, 0x0435, 0x0444, 0x0433,
0x0445, 0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E,
0x043F, 0x044F, 0x0440, 0x0441, 0x0442, 0x0443, 0x0436, 0x0432,
0x044C, 0x044B, 0x0437, 0x0448, 0x044D, 0x0449, 0x0447, 0x044A,
0x042E, 0x0410, 0x0411, 0x0426, 0x0414, 0x0415, 0x0424, 0x0413,
0x0425, 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E,
0x041F, 0x042F, 0x0420, 0x0421, 0x0422, 0x0423, 0x0416, 0x0412,
0x042C, 0x042B, 0x0417, 0x0428, 0x042D, 0x0429, 0x0427, 0x042A
};
@@ -842,5 +867,6 @@ static struct {
{ wxFONTENCODING_CP1256, encoding_table__CP1256}, { wxFONTENCODING_CP1256, encoding_table__CP1256},
{ wxFONTENCODING_CP1257, encoding_table__CP1257}, { wxFONTENCODING_CP1257, encoding_table__CP1257},
{ wxFONTENCODING_KOI8, encoding_table__KOI8}, { wxFONTENCODING_KOI8, encoding_table__KOI8},
{ wxFONTENCODING_KOI8_U, encoding_table__KOI8_U},
{wxFONTENCODING_MAX /*anything*/, NULL} {wxFONTENCODING_MAX /*anything*/, NULL}
}; };

View File

@@ -715,6 +715,7 @@ bool wxGetNativeFontEncoding(wxFontEncoding encoding,
break; break;
case wxFONTENCODING_KOI8: case wxFONTENCODING_KOI8:
case wxFONTENCODING_KOI8_U:
info->xregistry = wxT("koi8"); info->xregistry = wxT("koi8");
// we don't make distinction between koi8-r, koi8-u and koi8-ru (so far) // we don't make distinction between koi8-r, koi8-u and koi8-ru (so far)