diff options
Diffstat (limited to 'src/localization.c')
-rw-r--r-- | src/localization.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/localization.c b/src/localization.c index 23250a6a9..f2f51d911 100644 --- a/src/localization.c +++ b/src/localization.c @@ -17,6 +17,7 @@ */ #include "localization.h" +#include "charConv.h" #include "utils.h" #include <stdlib.h> @@ -30,6 +31,19 @@ static char *localeCharset = NULL; +char *utf8ToLocaleCharset(char *str) +{ + static char *ret = NULL; + + if (localeCharset) + ret = convCharset(localeCharset, "UTF-8", str, ret); + + if (!ret) + ret = xstrdup(str); + + return ret; +} + void setLocaleCharset(char *charset) { if (localeCharset) @@ -63,7 +77,7 @@ void initLocalization(void) strcmp(currentLocale, "POSIX") == 0) { WARNING("current locale is \"%s\"\n", currentLocale); - setLocaleCharset(xstrdup("")); + setLocaleCharset(xstrdup("ISO-8859-1")); } else if ((temp = nl_langinfo(CODESET))) { setLocaleCharset(xstrdup(temp)); } else { |