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] = "unknown" }; +#if defined(APPLICATION) && defined(__linux__) +static const char * const name_codepages_linux[NUM_CODEPAGES+1] = +{ + "iso8859-1", + "iso8859-7", + "iso8859-8", + "cp1251", + "iso8859-11", + "cp1256", + "iso8859-9", + "iso8859-2", + "cp1250", + "iso8859-15" /* closest, linux doesnt have a codepage named cp1252 */ + "cp932", + "cp936", + "cp949", + "cp950", + "utf8", + "cp437" +}; + +const char *get_current_codepage_name_linux(void) +{ + if (default_codepage < 0 || default_codepage >= NUM_CODEPAGES) + return name_codepages_linux[NUM_CODEPAGES]; + return name_codepages_linux[default_codepage]; +} +#endif + #else /* !HAVE_LCD_BITMAP, reduced support */ #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); void set_codepage(int cp); int utf8seek(const unsigned char* utf8, int offset); const char* get_codepage_name(int cp); +#if defined(APPLICATION) && defined(__linux__) +const char *get_current_codepage_name_linux(void); +#endif #endif /* _RBUNICODE_H_ */