From e1854c775e3068fc39fbdf335e472916f18779bd Mon Sep 17 00:00:00 2001 From: Till Varoquaux Date: Tue, 19 May 2015 13:53:59 -0400 Subject: [PATCH] always setlocale scan.ll utf8 code --- libpub/scan.ll | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/libpub/scan.ll b/libpub/scan.ll index 2464b0e3..f7ec3fe5 100644 --- a/libpub/scan.ll +++ b/libpub/scan.ll @@ -645,11 +645,7 @@ hex_to_char (const char *in) str unicode_to_utf8 (const char *in) { - static bool init; - if (!init) { - setlocale (LC_CTYPE, "en_US.UTF-8"); - init = true; - } + setlocale (LC_CTYPE, "en_US.UTF-8"); str ret; char *ep; mbstate_t state; @@ -667,6 +663,9 @@ unicode_to_utf8 (const char *in) ret = m; } } + if (!ret) { + ret = ""; + } return ret; }