From ded94e69c496f6cadc3c9dc856665b6b714283cf Mon Sep 17 00:00:00 2001 From: Marcoen Hirschberg Date: Mon, 1 Oct 2007 17:16:31 +0000 Subject: FS#7712 by Przemysław Hołubowski: New codepage (CP1250 - WIN1250) added MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14942 a1c6a512-1295-4272-9138-f99709370657 --- apps/lang/english.lang | 15 ++++++++++++++- apps/lang/polski.lang | 14 ++++++++++++++ apps/plugins/viewer.c | 2 ++ apps/settings_list.c | 17 +++++++++-------- docs/CREDITS | 1 + firmware/common/unicode.c | 11 ++++++----- tools/codepage_tables.c | 19 +++++++++++++++++++ tools/codepage_tables.h | 1 + tools/codepages.c | 14 ++++++++++++-- 9 files changed, 78 insertions(+), 16 deletions(-) diff --git a/apps/lang/english.lang b/apps/lang/english.lang index 6ad4313cf4..5b1aa68eec 100644 --- a/apps/lang/english.lang +++ b/apps/lang/english.lang @@ -11327,4 +11327,17 @@ lcd_color: "Bar (Gradient Colour)" - + + id: LANG_CODEPAGE_CENTRAL_EUROPEAN + desc: in codepage setting menu + user: + + *: "Central European (CP1250)" + + + *: "Central European (CP1250)" + + + *: "Central Eurpean" + + diff --git a/apps/lang/polski.lang b/apps/lang/polski.lang index bf3e90ae96..59fbf40452 100644 --- a/apps/lang/polski.lang +++ b/apps/lang/polski.lang @@ -11038,3 +11038,17 @@ radio: "Menu Radia FM" + + id: LANG_CODEPAGE_CENTRAL_EUROPEAN + desc: in codepage setting menu + user: + + *: "Europa Środkowa (CP1250)" + + + *: "Europa Środkowa (CP1250)" + + + *: "Europa Środkowa" + + diff --git a/apps/plugins/viewer.c b/apps/plugins/viewer.c index 37b7b49290..2e152f106d 100644 --- a/apps/plugins/viewer.c +++ b/apps/plugins/viewer.c @@ -247,6 +247,7 @@ struct preferences { ISO_8859_6, ISO_8859_9, ISO_8859_2, + CP1250, SJIS, GB2312, KSX1001, @@ -1191,6 +1192,7 @@ static bool encoding_setting(void) {"ISO-8859-6", -1}, {"ISO-8859-9", -1}, {"ISO-8859-2", -1}, + {"CP1250", -1}, {"SJIS", -1}, {"GB-2312", -1}, {"KSX-1001", -1}, diff --git a/apps/settings_list.c b/apps/settings_list.c index adc8a8572f..7981f279ff 100644 --- a/apps/settings_list.c +++ b/apps/settings_list.c @@ -1025,22 +1025,23 @@ const struct settings_list settings[] = { #ifdef HAVE_LCD_BITMAP /* The order must match with that in unicode.c */ "iso8859-1,iso8859-7,iso8859-8,cp1251,iso8859-11,cp1256," - "iso8859-9,iso8859-2,sjis,gb2312,ksx1001,big5,utf-8", - set_codepage, 13, + "iso8859-9,iso8859-2,cp1250,sjis,gb2312,ksx1001,big5,utf-8", + set_codepage, 14, ID2P(LANG_CODEPAGE_LATIN1), ID2P(LANG_CODEPAGE_GREEK), ID2P(LANG_CODEPAGE_HEBREW), ID2P(LANG_CODEPAGE_CYRILLIC), ID2P(LANG_CODEPAGE_THAI), ID2P(LANG_CODEPAGE_ARABIC), ID2P(LANG_CODEPAGE_TURKISH), ID2P(LANG_CODEPAGE_LATIN_EXTENDED), - ID2P(LANG_CODEPAGE_JAPANESE), ID2P(LANG_CODEPAGE_SIMPLIFIED), - ID2P(LANG_CODEPAGE_KOREAN), ID2P(LANG_CODEPAGE_TRADITIONAL), - ID2P(LANG_CODEPAGE_UTF8)), + ID2P(LANG_CODEPAGE_CENTRAL_EUROPEAN), ID2P(LANG_CODEPAGE_JAPANESE), + ID2P(LANG_CODEPAGE_SIMPLIFIED), ID2P(LANG_CODEPAGE_KOREAN), + ID2P(LANG_CODEPAGE_TRADITIONAL), ID2P(LANG_CODEPAGE_UTF8)), #else /* !HAVE_LCD_BITMAP */ /* The order must match with that in unicode.c */ - "iso8859-1,iso8859-7,cp1251,iso8859-9,iso8859-2,utf-8", - set_codepage, 6, + "iso8859-1,iso8859-7,cp1251,iso8859-9,iso8859-2,cp1250,utf-8", + set_codepage, 7, ID2P(LANG_CODEPAGE_LATIN1), ID2P(LANG_CODEPAGE_GREEK), 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 OFFON_SETTING(0,warnon_erase_dynplaylist, LANG_WARN_ERASEDYNPLAYLIST_MENU,false, diff --git a/docs/CREDITS b/docs/CREDITS index 0f09162eaf..1d8d57ee4c 100644 --- a/docs/CREDITS +++ b/docs/CREDITS @@ -337,6 +337,7 @@ Pinitnun Shanasabang Ken Fazzone David Bishop Hein-Pieter van Braam +Przemysław Hołubowski The libmad team The wavpack team diff --git a/firmware/common/unicode.c b/firmware/common/unicode.c index 2417b016d0..ba28edd15a 100644 --- a/firmware/common/unicode.c +++ b/firmware/common/unicode.c @@ -29,7 +29,7 @@ static int loaded_cp_table = 0; enum { 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 }; static const char *filename[NUM_TABLES] = @@ -42,7 +42,7 @@ static const char *filename[NUM_TABLES] = }; 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 */ @@ -51,8 +51,8 @@ static const char cp_2_table[NUM_CODEPAGES] = #define NUM_TABLES 1 enum { - ISO_8859_1 = 0, ISO_8859_7, WIN_1251, - ISO_8859_9, ISO_8859_2, UTF_8, NUM_CODEPAGES + ISO_8859_1 = 0, ISO_8859_7, WIN_1251, ISO_8859_9, + ISO_8859_2, WIN_1250, UTF_8, NUM_CODEPAGES }; static const char *filename[NUM_TABLES] = { @@ -60,7 +60,7 @@ static const char *filename[NUM_TABLES] = }; static const char cp_2_table[NUM_CODEPAGES] = { - 0, 1, 1, 1, 1, 0 + 0, 1, 1, 1, 1, 1, 0 }; #endif @@ -152,6 +152,7 @@ unsigned char* iso_decode(const unsigned char *iso, unsigned char *utf8, case WIN_1251: /* Cyrillic */ case ISO_8859_9: /* Turkish */ case ISO_8859_2: /* Latin Extended */ + case WIN_1250: /* Central European */ #ifdef HAVE_LCD_BITMAP case ISO_8859_8: /* Hebrew */ case ISO_8859_11: /* Thai */ diff --git a/tools/codepage_tables.c b/tools/codepage_tables.c index 5f5bec9bf3..02a2304a46 100644 --- a/tools/codepage_tables.c +++ b/tools/codepage_tables.c @@ -25,6 +25,25 @@ const unsigned short iso8859_7_to_uni[] = { 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[] = { 0x0402, 0x0403, 0x201A, 0x0453, 0x201E, 0x2026, 0x2020, 0x2021, /* 80-87 */ 0x20AC, 0x2030, 0x0409, 0x2039, 0x040A, 0x040C, 0x040B, 0x040F, /* 88-8F */ diff --git a/tools/codepage_tables.h b/tools/codepage_tables.h index 4e16ec5150..0c0bc019f3 100644 --- a/tools/codepage_tables.h +++ b/tools/codepage_tables.h @@ -18,6 +18,7 @@ ****************************************************************************/ 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 cp1256_to_uni[]; extern const unsigned short iso8859_2_to_uni[]; diff --git a/tools/codepages.c b/tools/codepages.c index 651a99c429..75441f2493 100644 --- a/tools/codepages.c +++ b/tools/codepages.c @@ -138,7 +138,17 @@ unsigned short iso_decode(unsigned char *latin1, int cp, int count) ucs = iso8859_2_to_uni[*latin1++ - 0xA1]; } 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: break; } @@ -211,7 +221,7 @@ int main(int argc, char **argv) of = fopen("iso.cp", "wb"); if (!of) return 1; - for (i=1; i<8; i++) { + for (i=1; i<9; i++) { for (j=0; j<128; j++) { k = (unsigned char)j + 128; -- cgit v1.2.3