On 2016-10-23 18:09 +0200, Romain Francoise wrote:

> On Sun, Oct 23, 2016 at 06:45:50AM +0000, Telnet wrote:
>> It would be better to add ``locales`` as tmux dependency, since tmux
>> 2.3 needs UTF8 locale to be configured. That won't be possible without
>> ``locales`` installed.

It seems that tmux needs _some_ UTF-8 locale, and it checks for
en_US.UTF-8 before testing the environment.  This is fine on OpenBSD
where en_US.UTF-8 always exist, but not on Debian.

> I guess that makes sense, yes. Thank you for the suggestion.

To me it seems that the locales dependency is neither sufficient nor
necessary.  Not sufficient because there is no guarantee that
en_US.UTF-8 or any other UTF8-locale is configured, and not necessary
because there is already a UTF-8 locale in libc-bin.

What do you think of the following patch instead?  It probably needs to
stay Debian-specific since C.UTF-8 is not widely supported outside
Debian.

Cheers,
       Sven

>From 8550e655e0517eb8e0f18528e79b965807593dc7 Mon Sep 17 00:00:00 2001
From: Sven Joachim <[email protected]>
Date: Sun, 9 Apr 2017 12:21:32 +0200
Subject: [PATCH] Check for C.UTF-8 on startup

On Debian, the C.UTF-8 locale is always available whereas en_US.UTF-8
might not be, even if the locales package is installed.
---
 tmux.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tmux.c b/tmux.c
index b980956..9e5edcd 100644
--- a/tmux.c
+++ b/tmux.c
@@ -193,7 +193,7 @@ main(int argc, char **argv)
 	int					 opt, flags, keys;
 	const struct options_table_entry	*oe;
 
-	if (setlocale(LC_CTYPE, "en_US.UTF-8") == NULL) {
+	if (setlocale(LC_CTYPE, "C.UTF-8") == NULL) {
 		if (setlocale(LC_CTYPE, "") == NULL)
 			errx(1, "invalid LC_ALL, LC_CTYPE or LANG");
 		s = nl_langinfo(CODESET);
-- 
2.11.0

Reply via email to