diff options
author | J. Alexander Treuman <jat@spatialrift.net> | 2007-01-08 04:31:44 +0000 |
---|---|---|
committer | J. Alexander Treuman <jat@spatialrift.net> | 2007-01-08 04:31:44 +0000 |
commit | 438c1add9de7aff5968add3b9e02fac30a62e74a (patch) | |
tree | 3d4a982db74f0c6d7da66f8bf5e746217f8f9545 /src/localization.c | |
parent | 90b4af03410cb151225853c458546abe6d696f1c (diff) | |
download | mpd-438c1add9de7aff5968add3b9e02fac30a62e74a.tar.gz mpd-438c1add9de7aff5968add3b9e02fac30a62e74a.tar.xz mpd-438c1add9de7aff5968add3b9e02fac30a62e74a.zip |
Convert log messages sent to stdout to the current locale's charset.
git-svn-id: https://svn.musicpd.org/mpd/trunk@5227 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to '')
-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 { |