summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/libunix.cc
diff options
context:
space:
mode:
authordshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-11-20 13:36:42 +0000
committerdshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-11-20 13:36:42 +0000
commitcbaaa32d55fd87eba6882c581db2ac32ef88c3f9 (patch)
treec7c89aca11947cf477953eb5138a0b476975c364 /crawl-ref/source/libunix.cc
parente3e729a0259c4c89296ac368556563ca096cd3e9 (diff)
downloadcrawl-ref-cbaaa32d55fd87eba6882c581db2ac32ef88c3f9.tar.gz
crawl-ref-cbaaa32d55fd87eba6882c581db2ac32ef88c3f9.zip
Allow UNICODE_LOCALE=. in makefile.unix to specify a setlocale(LC_ALL,"") call instead of forcing a specific locale (adapted from Guus' Debian patch). Also fixed some makefile.unix checks to strip variables that are prone to trailing spaces.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2885 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/libunix.cc')
-rw-r--r--crawl-ref/source/libunix.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/crawl-ref/source/libunix.cc b/crawl-ref/source/libunix.cc
index 9f264cf70d..ea2d535469 100644
--- a/crawl-ref/source/libunix.cc
+++ b/crawl-ref/source/libunix.cc
@@ -216,10 +216,13 @@ static void termio_init()
tcsetattr(0, TCSAFLUSH, &game_term);
+ crawl_state.unicode_ok = false;
#ifdef UNICODE_GLYPHS
- if ((crawl_state.unicode_ok = !!setlocale(LC_ALL, UNICODE_LOCALE)))
+ if (setlocale(LC_ALL, UNICODE_LOCALE)
+ && !strcmp(nl_langinfo(CODESET), "UTF-8"))
{
- crawl_state.glyph2strfn = unix_glyph2string;
+ crawl_state.unicode_ok = true;
+ crawl_state.glyph2strfn = unix_glyph2string;
crawl_state.multibyte_strlen = unix_multibyte_strlen;
}
#endif