detect system charset encoding automatically

This commit is contained in:
Andrzej Rybczak
2009-09-19 22:22:12 +02:00
parent f0b2c690ef
commit 310ea04f3e
3 changed files with 17 additions and 2 deletions

View File

@@ -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)