Johannes Weißl
2011-04-11 11:47:09 UTC
On small systems like OpenWrt nl_langinfo(CODESET) always returns
"ASCII". This way the user can override this choice if the terminal
emulator supports more character sets.
This is not a normal option for simplicity: The charset is needed right
at the start of cmus, and changing during runtime is not supported (or
needed?) right now.
---
ui_curses.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/ui_curses.c b/ui_curses.c
index 60f33bc..d009e77 100644
--- a/ui_curses.c
+++ b/ui_curses.c
@@ -2333,11 +2333,14 @@ int main(int argc, char *argv[])
setlocale(LC_CTYPE, "");
setlocale(LC_COLLATE, "");
+ charset = getenv("CMUS_CHARSET");
+ if (!charset || !charset[0]) {
#ifdef CODESET
- charset = nl_langinfo(CODESET);
+ charset = nl_langinfo(CODESET);
#else
- charset = "ISO-8859-1";
+ charset = "ISO-8859-1";
#endif
+ }
if (strcmp(charset, "UTF-8") == 0)
using_utf8 = 1;
"ASCII". This way the user can override this choice if the terminal
emulator supports more character sets.
This is not a normal option for simplicity: The charset is needed right
at the start of cmus, and changing during runtime is not supported (or
needed?) right now.
---
ui_curses.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/ui_curses.c b/ui_curses.c
index 60f33bc..d009e77 100644
--- a/ui_curses.c
+++ b/ui_curses.c
@@ -2333,11 +2333,14 @@ int main(int argc, char *argv[])
setlocale(LC_CTYPE, "");
setlocale(LC_COLLATE, "");
+ charset = getenv("CMUS_CHARSET");
+ if (!charset || !charset[0]) {
#ifdef CODESET
- charset = nl_langinfo(CODESET);
+ charset = nl_langinfo(CODESET);
#else
- charset = "ISO-8859-1";
+ charset = "ISO-8859-1";
#endif
+ }
if (strcmp(charset, "UTF-8") == 0)
using_utf8 = 1;
--
1.7.4.1
1.7.4.1