summaryrefslogtreecommitdiff
path: root/firmware/common
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2012-04-06 20:21:29 +0200
committerJens Arnold <amiconn@rockbox.org>2012-05-19 01:42:53 +0200
commit2d9c0bab540274e99480d965f38f266d20097976 (patch)
treee004fcdc65cd091521ca12575b82e672cc5908e3 /firmware/common
parent4a6b875eda8fe7827b8a55e42e48184a6588ee4c (diff)
downloadrockbox-2d9c0bab540274e99480d965f38f266d20097976.tar.gz
rockbox-2d9c0bab540274e99480d965f38f266d20097976.zip
Add support for cp1252 (Western European) codepage.
In Europe Windows defaults to its own codepage cp1252 (also known as "WinLatin" or "Windows-1252"). cp1252 adds some characters to ISO-8859-1. Some mp3 tagging software on Windows uses cp1252 instead of ISO-8859-1. This violates the ID3 specification, which requires tags to be ISO-8859-1 or Unicode. However, similar violations are made for other codepages and supported by Rockbox using the "Default Codepage" setting. Add support for cp1252 to enable people using such broken tools to override the correct decoding to get their tags displayed properly. Change-Id: I9f2ec478afe2503e99ee8e6609416c92b0f453e0 Reviewed-on: http://gerrit.rockbox.org/209 Reviewed-by: Jens Arnold <amiconn@rockbox.org> Tested-by: Jens Arnold <amiconn@rockbox.org>
Diffstat (limited to 'firmware/common')
-rw-r--r--firmware/common/unicode.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/firmware/common/unicode.c b/firmware/common/unicode.c
index 25d4a9129e..3ad63ee4fb 100644
--- a/firmware/common/unicode.c
+++ b/firmware/common/unicode.c
@@ -56,7 +56,7 @@ static const char * const filename[NUM_TABLES] =
56 56
57static const char cp_2_table[NUM_CODEPAGES] = 57static const char cp_2_table[NUM_CODEPAGES] =
58{ 58{
59 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 4, 5, 0 59 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 4, 5, 0
60}; 60};
61 61
62static const char * const name_codepages[NUM_CODEPAGES+1] = 62static const char * const name_codepages[NUM_CODEPAGES+1] =
@@ -70,6 +70,7 @@ static const char * const name_codepages[NUM_CODEPAGES+1] =
70 "ISO-8859-9", 70 "ISO-8859-9",
71 "ISO-8859-2", 71 "ISO-8859-2",
72 "CP1250", 72 "CP1250",
73 "CP1252",
73 "SJIS", 74 "SJIS",
74 "GB-2312", 75 "GB-2312",
75 "KSX-1001", 76 "KSX-1001",
@@ -80,7 +81,7 @@ static const char * const name_codepages[NUM_CODEPAGES+1] =
80 81
81#else /* !HAVE_LCD_BITMAP, reduced support */ 82#else /* !HAVE_LCD_BITMAP, reduced support */
82 83
83#define MAX_CP_TABLE_SIZE 640 84#define MAX_CP_TABLE_SIZE 768
84#define NUM_TABLES 1 85#define NUM_TABLES 1
85 86
86static const char * const filename[NUM_TABLES] = { 87static const char * const filename[NUM_TABLES] = {
@@ -89,7 +90,7 @@ static const char * const filename[NUM_TABLES] = {
89 90
90static const char cp_2_table[NUM_CODEPAGES] = 91static const char cp_2_table[NUM_CODEPAGES] =
91{ 92{
92 0, 1, 1, 1, 1, 1, 0 93 0, 1, 1, 1, 1, 1, 1, 0
93}; 94};
94 95
95static const char * const name_codepages[NUM_CODEPAGES+1] = 96static const char * const name_codepages[NUM_CODEPAGES+1] =
@@ -100,6 +101,7 @@ static const char * const name_codepages[NUM_CODEPAGES+1] =
100 "ISO-8859-9", 101 "ISO-8859-9",
101 "ISO-8859-2", 102 "ISO-8859-2",
102 "CP1250", 103 "CP1250",
104 "CP1252",
103 "UTF-8", 105 "UTF-8",
104 "unknown" 106 "unknown"
105}; 107};
@@ -190,6 +192,7 @@ unsigned char* iso_decode(const unsigned char *iso, unsigned char *utf8,
190 /* cp tells us which codepage to convert from */ 192 /* cp tells us which codepage to convert from */
191 switch (cp) { 193 switch (cp) {
192 case ISO_8859_7: /* Greek */ 194 case ISO_8859_7: /* Greek */
195 case WIN_1252: /* Western European */
193 case WIN_1251: /* Cyrillic */ 196 case WIN_1251: /* Cyrillic */
194 case ISO_8859_9: /* Turkish */ 197 case ISO_8859_9: /* Turkish */
195 case ISO_8859_2: /* Latin Extended */ 198 case ISO_8859_2: /* Latin Extended */