detect system charset encoding automatically
This commit is contained in:
@@ -38,6 +38,7 @@ dnl ================================
|
||||
dnl = checking for various headers =
|
||||
dnl ================================
|
||||
AC_CHECK_HEADERS([dirent.h regex.h], , AC_MSG_ERROR(vital headers missing))
|
||||
AC_CHECK_HEADERS([langinfo.h], , AC_MSG_WARN(locale detection disabled))
|
||||
|
||||
dnl ======================
|
||||
dnl = checking for iconv =
|
||||
|
||||
@@ -43,8 +43,13 @@
|
||||
#
|
||||
##### system encoding #####
|
||||
##
|
||||
## if you use encoding other than utf8, set it in
|
||||
## order to handle utf8 encoded strings properly.
|
||||
## ncmpcpp should detect your charset encoding
|
||||
## but if it failed to do so, you can specify
|
||||
## charset encoding you are using here.
|
||||
##
|
||||
## Note: Since MPD uses utf8 by default, setting
|
||||
## this option makes sense only if your encoding
|
||||
## is different.
|
||||
##
|
||||
#
|
||||
#system_encoding = ""
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user