summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2014-02-07 16:53:27 +0100
committerThomas Martitz <kugel@rockbox.org>2014-02-23 20:23:52 +0100
commit07f484824cd5c095e0e76e9a7e2db9d7bbdd55c7 (patch)
tree1bc95af737c31a8e30d63e9533a9afebc4794229
parentfacbaab1953f9ab355fb3a3259dc0acbaabd9cc5 (diff)
downloadrockbox-07f484824cd5c095e0e76e9a7e2db9d7bbdd55c7.tar.gz
rockbox-07f484824cd5c095e0e76e9a7e2db9d7bbdd55c7.zip
codepages: Translate to linux codepage names for use on APPLICATION.
The iocharset mount option names the codepages slightly differently and must be translated properly. Change-Id: I147a256e3453136282244201c27225a30cdfdca0
-rw-r--r--firmware/common/unicode.c29
-rw-r--r--firmware/include/rbunicode.h3
2 files changed, 32 insertions, 0 deletions
diff --git a/firmware/common/unicode.c b/firmware/common/unicode.c
index 3ad63ee4fb..2bb7bfb943 100644
--- a/firmware/common/unicode.c
+++ b/firmware/common/unicode.c
@@ -79,6 +79,35 @@ static const char * const name_codepages[NUM_CODEPAGES+1] =
79 "unknown" 79 "unknown"
80}; 80};
81 81
82#if defined(APPLICATION) && defined(__linux__)
83static const char * const name_codepages_linux[NUM_CODEPAGES+1] =
84{
85 "iso8859-1",
86 "iso8859-7",
87 "iso8859-8",
88 "cp1251",
89 "iso8859-11",
90 "cp1256",
91 "iso8859-9",
92 "iso8859-2",
93 "cp1250",
94 "iso8859-15" /* closest, linux doesnt have a codepage named cp1252 */
95 "cp932",
96 "cp936",
97 "cp949",
98 "cp950",
99 "utf8",
100 "cp437"
101};
102
103const char *get_current_codepage_name_linux(void)
104{
105 if (default_codepage < 0 || default_codepage >= NUM_CODEPAGES)
106 return name_codepages_linux[NUM_CODEPAGES];
107 return name_codepages_linux[default_codepage];
108}
109#endif
110
82#else /* !HAVE_LCD_BITMAP, reduced support */ 111#else /* !HAVE_LCD_BITMAP, reduced support */
83 112
84#define MAX_CP_TABLE_SIZE 768 113#define MAX_CP_TABLE_SIZE 768
diff --git a/firmware/include/rbunicode.h b/firmware/include/rbunicode.h
index d21a840b00..3c28b3031e 100644
--- a/firmware/include/rbunicode.h
+++ b/firmware/include/rbunicode.h
@@ -80,4 +80,7 @@ const unsigned char* utf8decode(const unsigned char *utf8, unsigned short *ucs);
80void set_codepage(int cp); 80void set_codepage(int cp);
81int utf8seek(const unsigned char* utf8, int offset); 81int utf8seek(const unsigned char* utf8, int offset);
82const char* get_codepage_name(int cp); 82const char* get_codepage_name(int cp);
83#if defined(APPLICATION) && defined(__linux__)
84const char *get_current_codepage_name_linux(void);
85#endif
83#endif /* _RBUNICODE_H_ */ 86#endif /* _RBUNICODE_H_ */