draw: check more quickly if we need UTF-8 conversion
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
88025f3d16
commit
beabf82ddf
7
draw.c
7
draw.c
|
@ -47,11 +47,12 @@ draw_iso2utf8(const char *iso, size_t len)
|
|||
size_t utf8len;
|
||||
char *utf8, *utf8p;
|
||||
static iconv_t iso2utf8 = (iconv_t) -1;
|
||||
static int8_t dont_need_convert = -1;
|
||||
|
||||
if(!len)
|
||||
return NULL;
|
||||
if(dont_need_convert == -1)
|
||||
dont_need_convert = !a_strcmp(nl_langinfo(CODESET), "UTF-8");
|
||||
|
||||
if(!a_strcmp(nl_langinfo(CODESET), "UTF-8"))
|
||||
if(!len || dont_need_convert)
|
||||
return NULL;
|
||||
|
||||
if(iso2utf8 == (iconv_t) -1)
|
||||
|
|
Loading…
Reference in New Issue