aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/term_ascii.c
diff options
context:
space:
mode:
Diffstat (limited to 'term_ascii.c')
-rw-r--r--term_ascii.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/term_ascii.c b/term_ascii.c
index c4633b3d..7215a597 100644
--- a/term_ascii.c
+++ b/term_ascii.c
@@ -1,4 +1,4 @@
-/* $Id: term_ascii.c,v 1.51 2015/10/13 22:59:54 schwarze Exp $ */
+/* $Id: term_ascii.c,v 1.52 2015/11/12 21:50:03 schwarze Exp $ */
/*
* Copyright (c) 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2014, 2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -88,8 +88,16 @@ ascii_init(enum termenc enc, const struct manoutput *outopts)
#if HAVE_WCHAR
if (TERMENC_ASCII != enc) {
+
+ /*
+ * Do not change any of this to LC_ALL. It might break
+ * the formatting by subtly changing the behaviour of
+ * various functions, for example strftime(3). As a
+ * worst case, it might even cause buffer overflows.
+ */
+
v = TERMENC_LOCALE == enc ?
- setlocale(LC_ALL, "") :
+ setlocale(LC_CTYPE, "") :
setlocale(LC_CTYPE, "en_US.UTF-8");
if (NULL != v && MB_CUR_MAX > 1) {
p->enc = enc;