diff options
author | Andrzej Rybczak <electricityispower@gmail.com> | 2009-09-19 22:22:12 +0200 |
---|---|---|
committer | Andrzej Rybczak <electricityispower@gmail.com> | 2009-09-19 22:22:12 +0200 |
commit | 310ea04f3e4d33b564472b51e7dc46ef4ff7dbad (patch) | |
tree | e93ed67d01d0c62ee1260b346ae3c81bbd71ffaf /src | |
parent | f0b2c690efa482d81649fd67b464f77d0f8977bb (diff) |
detect system charset encoding automatically
Diffstat (limited to 'src')
-rw-r--r-- | src/settings.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/settings.cpp b/src/settings.cpp index 6b019f2b..931a8899 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -31,6 +31,10 @@ #include "lyrics.h" #include "settings.h" +#ifdef HAVE_LANGINFO_H +# include <langinfo.h> +#endif + const std::string config_file = config_dir + "config"; const std::string keys_config_file = config_dir + "keys"; @@ -318,6 +322,11 @@ void DefaultConfiguration(ncmpcpp_config &conf) conf.lyrics_db = 0; conf.regex_type = 0; conf.lines_scrolled = 2; +# ifdef HAVE_LANGINFO_H + conf.system_encoding = nl_langinfo(CODESET); + if (conf.system_encoding == "UTF-8") // mpd uses utf-8 by default so no need to convert + conf.system_encoding.clear(); +# endif // HAVE_LANGINFO_H } void ReadKeys(ncmpcpp_keys &keys) |