diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2016-07-31 09:29:13 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2016-07-31 09:29:13 +0000 |
commit | 89a1a1be54eefe77cc04401526ea22323c644115 (patch) | |
tree | 8071c288f5714fd1fbb80b7a53e500e58014b3e7 /test-wchar.c | |
parent | 7f6377086cfbc884dfcb75e0a4075d0f0cf8b73d (diff) | |
download | mandoc-89a1a1be54eefe77cc04401526ea22323c644115.tar.gz mandoc-89a1a1be54eefe77cc04401526ea22323c644115.tar.zst mandoc-89a1a1be54eefe77cc04401526ea22323c644115.zip |
Autodetect a suitable locale for -Tutf8 mode,
and allow overriding it manually.
Based on a patch from Svyatoslav Mishyn <juef at openmailbox dot org>
tweaked by me.
The idea originally came up in a conversation with Markus Waldeck.
Diffstat (limited to 'test-wchar.c')
-rw-r--r-- | test-wchar.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/test-wchar.c b/test-wchar.c index a096705e..32962d9f 100644 --- a/test-wchar.c +++ b/test-wchar.c @@ -1,4 +1,4 @@ -/* $Id: test-wchar.c,v 1.3 2015/10/06 18:32:20 schwarze Exp $ */ +/* $Id: test-wchar.c,v 1.4 2016/07/31 09:29:13 schwarze Exp $ */ /* * Copyright (c) 2014 Ingo Schwarze <schwarze@openbsd.org> * @@ -35,9 +35,9 @@ main(void) return 1; } - if (setlocale(LC_CTYPE, "en_US.UTF-8") == NULL) { - fputs("setlocale(LC_CTYPE, \"en_US.UTF-8\") failed\n", - stderr); + if (setlocale(LC_CTYPE, UTF8_LOCALE) == NULL) { + fprintf(stderr, "setlocale(LC_CTYPE, \"%s\") failed\n", + UTF8_LOCALE); return 1; } |