Skip to content

Instantly share code, notes, and snippets.

@uwabami
Last active January 9, 2018 04:05
Show Gist options
  • Save uwabami/5f0122a72f253af0bca2df2501e3a8dd to your computer and use it in GitHub Desktop.
Save uwabami/5f0122a72f253af0bca2df2501e3a8dd to your computer and use it in GitHub Desktop.
tmux v2.6 で en_US.UTF-8 決め打ちを止める.ロケールの修正か wcwidth-cjk を使うことを前提とする
From: Youhei SASAKI <uwabami@gfd-dennou.org>
Date: Tue, 9 Jan 2018 13:03:58 +0900
Subject: Unset locale forcing
Signed-off-by: Youhei SASAKI <uwabami@gfd-dennou.org>
---
tmux.c | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/tmux.c b/tmux.c
index 78cb499..3c9a7a1 100644
--- a/tmux.c
+++ b/tmux.c
@@ -194,14 +194,11 @@ main(int argc, char **argv)
int opt, flags, keys;
const struct options_table_entry *oe;
- if (setlocale(LC_CTYPE, "en_US.UTF-8") == NULL &&
- 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);
- if (strcasecmp(s, "UTF-8") != 0 && strcasecmp(s, "UTF8") != 0)
- errx(1, "need UTF-8 locale (LC_CTYPE) but have %s", s);
- }
+ if (setlocale(LC_CTYPE, "") == NULL)
+ errx(1, "invalid LC_ALL, LC_CTYPE or LANG");
+ s = nl_langinfo(CODESET);
+ if (strcasecmp(s, "UTF-8") != 0 && strcasecmp(s, "UTF8") != 0)
+ errx(1, "need UTF-8 locale (LC_CTYPE) but have %s", s);
setlocale(LC_TIME, "");
tzset();
From: Youhei SASAKI <uwabami@gfd-dennou.org>
Date: Tue, 16 May 2017 18:44:57 +0900
Subject: Unset locale as en_US.UTF-8
---
tmux.c | 12 +--
tmux.c.orig | 352 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 357 insertions(+), 7 deletions(-)
create mode 100644 tmux.c.orig
--- a/tmux.c
+++ b/tmux.c
@@ -194,13 +194,11 @@
int opt, flags, keys;
const struct options_table_entry *oe;
- if (setlocale(LC_CTYPE, "en_US.UTF-8") == NULL) {
- if (setlocale(LC_CTYPE, "") == NULL)
- errx(1, "invalid LC_ALL, LC_CTYPE or LANG");
- s = nl_langinfo(CODESET);
- if (strcasecmp(s, "UTF-8") != 0 && strcasecmp(s, "UTF8") != 0)
- errx(1, "need UTF-8 locale (LC_CTYPE) but have %s", s);
- }
+ if (setlocale(LC_CTYPE, "") == NULL)
+ errx(1, "invalid LC_ALL, LC_CTYPE or LANG");
+ s = nl_langinfo(CODESET);
+ if (strcasecmp(s, "UTF-8") != 0 && strcasecmp(s, "UTF8") != 0)
+ errx(1, "need UTF-8 locale (LC_CTYPE) but have %s", s);
setlocale(LC_TIME, "");
tzset();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment