From 2d9c0bab540274e99480d965f38f266d20097976 Mon Sep 17 00:00:00 2001 From: Dominik Riebeling Date: Fri, 6 Apr 2012 20:21:29 +0200 Subject: 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 Tested-by: Jens Arnold --- firmware/common/unicode.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'firmware/common') 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] = static const char cp_2_table[NUM_CODEPAGES] = { - 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 4, 5, 0 + 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 4, 5, 0 }; static const char * const name_codepages[NUM_CODEPAGES+1] = @@ -70,6 +70,7 @@ static const char * const name_codepages[NUM_CODEPAGES+1] = "ISO-8859-9", "ISO-8859-2", "CP1250", + "CP1252", "SJIS", "GB-2312", "KSX-1001", @@ -80,7 +81,7 @@ static const char * const name_codepages[NUM_CODEPAGES+1] = #else /* !HAVE_LCD_BITMAP, reduced support */ -#define MAX_CP_TABLE_SIZE 640 +#define MAX_CP_TABLE_SIZE 768 #define NUM_TABLES 1 static const char * const filename[NUM_TABLES] = { @@ -89,7 +90,7 @@ static const char * const filename[NUM_TABLES] = { static const char cp_2_table[NUM_CODEPAGES] = { - 0, 1, 1, 1, 1, 1, 0 + 0, 1, 1, 1, 1, 1, 1, 0 }; static const char * const name_codepages[NUM_CODEPAGES+1] = @@ -100,6 +101,7 @@ static const char * const name_codepages[NUM_CODEPAGES+1] = "ISO-8859-9", "ISO-8859-2", "CP1250", + "CP1252", "UTF-8", "unknown" }; @@ -190,6 +192,7 @@ unsigned char* iso_decode(const unsigned char *iso, unsigned char *utf8, /* cp tells us which codepage to convert from */ switch (cp) { case ISO_8859_7: /* Greek */ + case WIN_1252: /* Western European */ case WIN_1251: /* Cyrillic */ case ISO_8859_9: /* Turkish */ case ISO_8859_2: /* Latin Extended */ -- cgit v1.2.3