1
0
Fork 0
forked from len0rd/rockbox

FS#7712 by Przemysław Hołubowski: New codepage (CP1250 - WIN1250) added

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14942 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Marcoen Hirschberg 2007-10-01 17:16:31 +00:00
parent b8753ffdaa
commit ded94e69c4
9 changed files with 78 additions and 16 deletions

View file

@ -11327,4 +11327,17 @@
lcd_color: "Bar (Gradient Colour)" lcd_color: "Bar (Gradient Colour)"
</voice> </voice>
</phrase> </phrase>
<phrase>
id: LANG_CODEPAGE_CENTRAL_EUROPEAN
desc: in codepage setting menu
user:
<source>
*: "Central European (CP1250)"
</source>
<dest>
*: "Central European (CP1250)"
</dest>
<voice>
*: "Central Eurpean"
</voice>
</phrase>

View file

@ -11038,3 +11038,17 @@
radio: "Menu Radia FM" radio: "Menu Radia FM"
</voice> </voice>
</phrase> </phrase>
<phrase>
id: LANG_CODEPAGE_CENTRAL_EUROPEAN
desc: in codepage setting menu
user:
<source>
*: "Europa Środkowa (CP1250)"
</source>
<dest>
*: "Europa Środkowa (CP1250)"
</dest>
<voice>
*: "Europa Środkowa"
</voice>
</phrase>

View file

@ -247,6 +247,7 @@ struct preferences {
ISO_8859_6, ISO_8859_6,
ISO_8859_9, ISO_8859_9,
ISO_8859_2, ISO_8859_2,
CP1250,
SJIS, SJIS,
GB2312, GB2312,
KSX1001, KSX1001,
@ -1191,6 +1192,7 @@ static bool encoding_setting(void)
{"ISO-8859-6", -1}, {"ISO-8859-6", -1},
{"ISO-8859-9", -1}, {"ISO-8859-9", -1},
{"ISO-8859-2", -1}, {"ISO-8859-2", -1},
{"CP1250", -1},
{"SJIS", -1}, {"SJIS", -1},
{"GB-2312", -1}, {"GB-2312", -1},
{"KSX-1001", -1}, {"KSX-1001", -1},

View file

@ -1025,22 +1025,23 @@ const struct settings_list settings[] = {
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
/* The order must match with that in unicode.c */ /* The order must match with that in unicode.c */
"iso8859-1,iso8859-7,iso8859-8,cp1251,iso8859-11,cp1256," "iso8859-1,iso8859-7,iso8859-8,cp1251,iso8859-11,cp1256,"
"iso8859-9,iso8859-2,sjis,gb2312,ksx1001,big5,utf-8", "iso8859-9,iso8859-2,cp1250,sjis,gb2312,ksx1001,big5,utf-8",
set_codepage, 13, set_codepage, 14,
ID2P(LANG_CODEPAGE_LATIN1), ID2P(LANG_CODEPAGE_GREEK), ID2P(LANG_CODEPAGE_LATIN1), ID2P(LANG_CODEPAGE_GREEK),
ID2P(LANG_CODEPAGE_HEBREW), ID2P(LANG_CODEPAGE_CYRILLIC), ID2P(LANG_CODEPAGE_HEBREW), ID2P(LANG_CODEPAGE_CYRILLIC),
ID2P(LANG_CODEPAGE_THAI), ID2P(LANG_CODEPAGE_ARABIC), ID2P(LANG_CODEPAGE_THAI), ID2P(LANG_CODEPAGE_ARABIC),
ID2P(LANG_CODEPAGE_TURKISH), ID2P(LANG_CODEPAGE_LATIN_EXTENDED), ID2P(LANG_CODEPAGE_TURKISH), ID2P(LANG_CODEPAGE_LATIN_EXTENDED),
ID2P(LANG_CODEPAGE_JAPANESE), ID2P(LANG_CODEPAGE_SIMPLIFIED), ID2P(LANG_CODEPAGE_CENTRAL_EUROPEAN), ID2P(LANG_CODEPAGE_JAPANESE),
ID2P(LANG_CODEPAGE_KOREAN), ID2P(LANG_CODEPAGE_TRADITIONAL), ID2P(LANG_CODEPAGE_SIMPLIFIED), ID2P(LANG_CODEPAGE_KOREAN),
ID2P(LANG_CODEPAGE_UTF8)), ID2P(LANG_CODEPAGE_TRADITIONAL), ID2P(LANG_CODEPAGE_UTF8)),
#else /* !HAVE_LCD_BITMAP */ #else /* !HAVE_LCD_BITMAP */
/* The order must match with that in unicode.c */ /* The order must match with that in unicode.c */
"iso8859-1,iso8859-7,cp1251,iso8859-9,iso8859-2,utf-8", "iso8859-1,iso8859-7,cp1251,iso8859-9,iso8859-2,cp1250,utf-8",
set_codepage, 6, set_codepage, 7,
ID2P(LANG_CODEPAGE_LATIN1), ID2P(LANG_CODEPAGE_GREEK), ID2P(LANG_CODEPAGE_LATIN1), ID2P(LANG_CODEPAGE_GREEK),
ID2P(LANG_CODEPAGE_CYRILLIC), ID2P(LANG_CODEPAGE_TURKISH), ID2P(LANG_CODEPAGE_CYRILLIC), ID2P(LANG_CODEPAGE_TURKISH),
ID2P(LANG_CODEPAGE_LATIN_EXTENDED), ID2P(LANG_CODEPAGE_UTF8)), ID2P(LANG_CODEPAGE_LATIN_EXTENDED), ID2P(LANG_CODEPAGE_CENTRAL_EUROPEAN),
ID2P(LANG_CODEPAGE_UTF8)),
#endif #endif
OFFON_SETTING(0,warnon_erase_dynplaylist, OFFON_SETTING(0,warnon_erase_dynplaylist,
LANG_WARN_ERASEDYNPLAYLIST_MENU,false, LANG_WARN_ERASEDYNPLAYLIST_MENU,false,

View file

@ -337,6 +337,7 @@ Pinitnun Shanasabang
Ken Fazzone Ken Fazzone
David Bishop David Bishop
Hein-Pieter van Braam Hein-Pieter van Braam
Przemysław Hołubowski
The libmad team The libmad team
The wavpack team The wavpack team

View file

@ -29,7 +29,7 @@ static int loaded_cp_table = 0;
enum { enum {
ISO_8859_1 = 0, ISO_8859_7, ISO_8859_8, WIN_1251, ISO_8859_1 = 0, ISO_8859_7, ISO_8859_8, WIN_1251,
ISO_8859_11, WIN_1256, ISO_8859_9, ISO_8859_2, ISO_8859_11, WIN_1256, ISO_8859_9, ISO_8859_2, WIN_1250,
SJIS, GB_2312, KSX_1001, BIG_5, UTF_8, NUM_CODEPAGES SJIS, GB_2312, KSX_1001, BIG_5, UTF_8, NUM_CODEPAGES
}; };
static const char *filename[NUM_TABLES] = static const char *filename[NUM_TABLES] =
@ -42,7 +42,7 @@ static const char *filename[NUM_TABLES] =
}; };
static const char cp_2_table[NUM_CODEPAGES] = static const char cp_2_table[NUM_CODEPAGES] =
{ {
0, 1, 1, 1, 1, 1, 1, 1, 2, 3, 4, 5, 0 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 4, 5, 0
}; };
#else /* !HAVE_LCD_BITMAP, reduced support */ #else /* !HAVE_LCD_BITMAP, reduced support */
@ -51,8 +51,8 @@ static const char cp_2_table[NUM_CODEPAGES] =
#define NUM_TABLES 1 #define NUM_TABLES 1
enum { enum {
ISO_8859_1 = 0, ISO_8859_7, WIN_1251, ISO_8859_1 = 0, ISO_8859_7, WIN_1251, ISO_8859_9,
ISO_8859_9, ISO_8859_2, UTF_8, NUM_CODEPAGES ISO_8859_2, WIN_1250, UTF_8, NUM_CODEPAGES
}; };
static const char *filename[NUM_TABLES] = static const char *filename[NUM_TABLES] =
{ {
@ -60,7 +60,7 @@ static const char *filename[NUM_TABLES] =
}; };
static const char cp_2_table[NUM_CODEPAGES] = static const char cp_2_table[NUM_CODEPAGES] =
{ {
0, 1, 1, 1, 1, 0 0, 1, 1, 1, 1, 1, 0
}; };
#endif #endif
@ -152,6 +152,7 @@ unsigned char* iso_decode(const unsigned char *iso, unsigned char *utf8,
case WIN_1251: /* Cyrillic */ case WIN_1251: /* Cyrillic */
case ISO_8859_9: /* Turkish */ case ISO_8859_9: /* Turkish */
case ISO_8859_2: /* Latin Extended */ case ISO_8859_2: /* Latin Extended */
case WIN_1250: /* Central European */
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
case ISO_8859_8: /* Hebrew */ case ISO_8859_8: /* Hebrew */
case ISO_8859_11: /* Thai */ case ISO_8859_11: /* Thai */

View file

@ -25,6 +25,25 @@ const unsigned short iso8859_7_to_uni[] = {
0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x0384, 0x0385, 0x0386, 0x00B7 /* B0-B7 */ 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x0384, 0x0385, 0x0386, 0x00B7 /* B0-B7 */
}; };
const unsigned short cp1250_to_uni[] = {
0x20AC, 0x00A0, 0x201A, 0x00A0, 0x201E, 0x2026, 0x2020, 0x2021, /* 80-87 */
0x00A0, 0x2030, 0x0160, 0x2039, 0x015A, 0x0164, 0x017D, 0x0179, /* 88-8F */
0x00A0, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, /* 90-97 */
0x00A0, 0x2122, 0x0161, 0x203A, 0x015B, 0x0165, 0x017E, 0x017A, /* 98-9F */
0x00A0, 0x02C7, 0x02D8, 0x0141, 0x00A4, 0x0104, 0x00A6, 0x00A7, /* A0-A7 */
0x00A8, 0x00A9, 0x015E, 0x00AB, 0x00AC, 0X00AD, 0x00AE, 0x017B, /* A8-AF */
0x00B0, 0x00B1, 0x02DB, 0x0142, 0x00B4, 0x00B5, 0x00B6, 0x00B7, /* B0-B7 */
0x00B8, 0x0105, 0x015F, 0x00BB, 0x013D, 0x02DD, 0x013E, 0x017C, /* B8-BF */
0x0154, 0x00C1, 0x00C2, 0x0102, 0x00C4, 0x0139, 0x0106, 0x00C7, /* C0-C7 */
0x010C, 0x00C9, 0x0118, 0x00CB, 0x011A, 0x00CD, 0x00CE, 0x010E, /* C8-CF */
0x0110, 0x0143, 0x0147, 0x00D3, 0x00D4, 0x0150, 0x00D6, 0x00D7, /* D0-D7 */
0x0158, 0x016E, 0x00DA, 0x0170, 0x00DC, 0x00DD, 0x0162, 0x00DF, /* D8-DF */
0x0155, 0x00E1, 0x00E2, 0x0103, 0x00E4, 0x013A, 0x0107, 0x00E7, /* E0-E7 */
0x010D, 0x00E9, 0x0119, 0x00EB, 0x011B, 0x00ED, 0x00EE, 0x010F, /* E8-EF */
0x0111, 0x0144, 0x0148, 0x00F3, 0x00F4, 0X0151, 0x00F6, 0x00F7, /* F0-F7 */
0x0159, 0x016F, 0x00FA, 0x0171, 0x00FC, 0x00FD, 0x0163, 0x02D9 /* F8-FA */
};
const unsigned short cp1251_to_uni[] = { const unsigned short cp1251_to_uni[] = {
0x0402, 0x0403, 0x201A, 0x0453, 0x201E, 0x2026, 0x2020, 0x2021, /* 80-87 */ 0x0402, 0x0403, 0x201A, 0x0453, 0x201E, 0x2026, 0x2020, 0x2021, /* 80-87 */
0x20AC, 0x2030, 0x0409, 0x2039, 0x040A, 0x040C, 0x040B, 0x040F, /* 88-8F */ 0x20AC, 0x2030, 0x0409, 0x2039, 0x040A, 0x040C, 0x040B, 0x040F, /* 88-8F */

View file

@ -18,6 +18,7 @@
****************************************************************************/ ****************************************************************************/
extern const unsigned short iso8859_7_to_uni[]; extern const unsigned short iso8859_7_to_uni[];
extern const unsigned short cp1250_to_uni[];
extern const unsigned short cp1251_to_uni[]; extern const unsigned short cp1251_to_uni[];
extern const unsigned short cp1256_to_uni[]; extern const unsigned short cp1256_to_uni[];
extern const unsigned short iso8859_2_to_uni[]; extern const unsigned short iso8859_2_to_uni[];

View file

@ -138,7 +138,17 @@ unsigned short iso_decode(unsigned char *latin1, int cp, int count)
ucs = iso8859_2_to_uni[*latin1++ - 0xA1]; ucs = iso8859_2_to_uni[*latin1++ - 0xA1];
} }
break; break;
case 0x08: /* Central European (CP1250) */
while (count--) {
/* first convert to unicode */
if (*latin1 < 0x80)
ucs = *latin1++;
else
ucs = cp1250_to_uni[*latin1++ - 0x80];
}
break;
default: default:
break; break;
} }
@ -211,7 +221,7 @@ int main(int argc, char **argv)
of = fopen("iso.cp", "wb"); of = fopen("iso.cp", "wb");
if (!of) return 1; if (!of) return 1;
for (i=1; i<8; i++) { for (i=1; i<9; i++) {
for (j=0; j<128; j++) { for (j=0; j<128; j++) {
k = (unsigned char)j + 128; k = (unsigned char)j + 128;