diff --git a/apps/plugins/viewer.c b/apps/plugins/viewer.c old mode 100644 new mode 100755 index 7e03c55..0f6b940 --- a/apps/plugins/viewer.c +++ b/apps/plugins/viewer.c @@ -437,22 +437,23 @@ int glyph_width(int ch) unsigned char* get_ucs(const unsigned char* str, unsigned short* ch) { - unsigned char utf8_tmp[6]; - int count; + unsigned char utf8_tmp[3]; if (prefs.encoding == UTF_8) return (unsigned char*)rb->utf8decode(str, ch); - count = BUFFER_OOB(str+2)? 1:2; - rb->iso_decode(str, utf8_tmp, prefs.encoding, count); + rb->iso_decode(str, utf8_tmp, prefs.encoding, 1); rb->utf8decode(utf8_tmp, ch); #ifdef HAVE_LCD_BITMAP - if ((prefs.encoding == SJIS && *str > 0xA0 && *str < 0xE0) || prefs.encoding < SJIS) + if (*str < 0x80 || prefs.encoding < SJIS + || (prefs.encoding == SJIS && *str > 0xA0 && *str < 0xE0)) return (unsigned char*)str+1; else -#endif return (unsigned char*)str+2; +#else + return (unsigned char*)str+1; +#endif } bool done = false;