diff options
author | ben <ben@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2007-05-07 17:02:42 +0000 |
---|---|---|
committer | ben <ben@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2007-05-07 17:02:42 +0000 |
commit | 0600d0b11710c654939de70d70dc97ccde4e3e95 (patch) | |
tree | dc0c99d90e8efcd95fbaa378f710aabceeea5723 /libmenu | |
parent | a2e997c1555cfddd7db1848249786faa43804764 (diff) | |
download | mpv-0600d0b11710c654939de70d70dc97ccde4e3e95.tar.bz2 mpv-0600d0b11710c654939de70d70dc97ccde4e3e95.tar.xz |
use already existing function to get utf8 char in libmenu (thx to reimar)
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@23250 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmenu')
-rw-r--r-- | libmenu/menu.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/libmenu/menu.c b/libmenu/menu.c index e751dbd6a6..a319bb3cb7 100644 --- a/libmenu/menu.c +++ b/libmenu/menu.c @@ -11,6 +11,7 @@ #include "libvo/osd.h" #include "libvo/font_load.h" +#include "libvo/sub.h" #include "osdep/keycodes.h" #include "asxparser.h" #include "stream/stream.h" @@ -304,14 +305,9 @@ static int get_next_char(char **txt) int c; c = (unsigned char)*(*txt)++; if (c >= 0x80) { - if (menu_utf8){ - if ((c & 0xe0) == 0xc0) /* 2 bytes U+00080..U+0007FF*/ - c = (c & 0x1f)<<6 | ((unsigned char)*(*txt)++ & 0x3f); - else if((c & 0xf0) == 0xe0){ /* 3 bytes U+00800..U+00FFFF*/ - c = (((c & 0x0f)<<6) | ((unsigned char)*(*txt)++ & 0x3f))<<6; - c |= ((unsigned char)*(*txt)++ & 0x3f); - } - } else if (menu_unicode) + if (menu_utf8) + c = utf8_get_char((const char*)txt); + else if (menu_unicode) c = (c<<8) + (unsigned char)*(*txt)++; } if (!c) c++; // avoid UCS 0 |