COMMON: Add Persian language & CP1256 encoding

This commit is contained in:
lolbot-iichan 2020-05-18 23:11:52 +03:00 committed by Eugene Sandulenko
parent 7c29b5db7d
commit d8951b2aa1
4 changed files with 27 additions and 0 deletions

View File

@ -50,6 +50,7 @@ const LanguageDescription g_languages[] = {
{ "kr", "ko_KR", "Korean", KO_KOR },
{ "lv", "lv_LV", "Latvian", LV_LAT },
{ "nb", "nb_NO", "Norwegian Bokm\xE5l", NB_NOR },
{ "fa", "fa_IR", "Persian (Iran)", FA_IRN },
{ "pl", "pl_PL", "Polish", PL_POL },
{ "br", "pt_BR", "Portuguese (Brazil)", PT_BRA },
{ "pt", "pt_PT", "Portuguese (Portugal)", PT_POR },

View File

@ -55,6 +55,7 @@ enum Language {
KO_KOR,
LV_LAT,
NB_NOR,
FA_IRN,
PL_POL,
PT_BRA,
PT_POR,

View File

@ -249,6 +249,23 @@ static const uint32 g_windows1255ConversionTable[] = {0x20AC, 0x0081, 0x201A, 0x
0x05E0, 0x05E1, 0x05E2, 0x05E3, 0x05E4, 0x05E5, 0x05E6, 0x05E7,
0x05E8, 0x05E9, 0x05EA, 0x00FB, 0x00FC, 0x200E, 0x200F, 0x00FF};
static const uint32 g_windows1256ConversionTable[] = {0x20AC, 0x067E, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021,
0x02C6, 0x2030, 0x0679, 0x2039, 0x0152, 0x0686, 0x0698, 0x0688,
0x06AF, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014,
0x06A9, 0x2122, 0x0691, 0x203A, 0x0153, 0x200C, 0x200D, 0x06BA,
0x00A0, 0x060C, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7,
0x00A8, 0x00A9, 0x06BE, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF,
0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7,
0x00B8, 0x00B9, 0x061B, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x061F,
0x06C1, 0x0621, 0x0622, 0x0623, 0x0624, 0x0625, 0x0626, 0x0627,
0x0628, 0x0629, 0x062A, 0x062B, 0x062C, 0x062D, 0x062E, 0x062F,
0x0630, 0x0631, 0x0632, 0x0633, 0x0634, 0x0635, 0x0636, 0x00D7,
0x0637, 0x0638, 0x0639, 0x063A, 0x0640, 0x0641, 0x0642, 0x0643,
0x00E0, 0x0644, 0x00E2, 0x0645, 0x0646, 0x0647, 0x0648, 0x00E7,
0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x0649, 0x064A, 0x00EE, 0x00EF,
0x064B, 0x064C, 0x064D, 0x064E, 0x00F4, 0x064F, 0x0650, 0x00F7,
0x0651, 0x00F9, 0x0652, 0x00FB, 0x00FC, 0x200E, 0x200F, 0x06D2};
static const uint32 g_windows1257ConversionTable[] = {0x20AC, 0x0081, 0x201A, 0x0083, 0x201E, 0x2026, 0x2020, 0x2021,
0x0088, 0x2030, 0x008A, 0x2039, 0x008C, 0x00A8, 0x02C7, 0x00B8,
0x0090, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014,
@ -276,6 +293,7 @@ static char const *const g_codePageMap[] = {
"WINDOWS-1253", /* kWindows1253 */
"WINDOWS-1254", /* kWindows1254 */
"WINDOWS-1255", /* kWindows1255 */
"WINDOWS-1256", /* kWindows1256 */
"WINDOWS-1257", /* kWindows1257 */
"MS932", /* kWindows932 */
"MSCP949", /* kWindows949 */
@ -310,6 +328,9 @@ void String::decodeOneByte(U32String &dst, CodePage page) const {
case kWindows1255:
dst += g_windows1255ConversionTable[index];
break;
case kWindows1256:
dst += g_windows1256ConversionTable[index];
break;
case kWindows1257:
dst += g_windows1257ConversionTable[index];
break;
@ -363,6 +384,9 @@ void U32String::encodeOneByte(String &dst, CodePage page) const {
case kWindows1255:
conversionTable = g_windows1255ConversionTable;
break;
case kWindows1256:
conversionTable = g_windows1256ConversionTable;
break;
case kWindows1257:
conversionTable = g_windows1257ConversionTable;
break;

View File

@ -37,6 +37,7 @@ enum CodePage {
kWindows1253,
kWindows1254,
kWindows1255,
kWindows1256,
kWindows1257,
kWindows932,
kWindows949,