[Git][NTPsec/ntpsec][master] Possible fix for unicode/locale bug
Ian Bruene
gitlab at mg.gitlab.com
Fri Sep 29 22:41:51 UTC 2017
Ian Bruene pushed to branch master at NTPsec / ntpsec
Commits:
b80ddd46 by Ian Bruene at 2017-09-29T17:40:18-05:00
Possible fix for unicode/locale bug
- - - - -
1 changed file:
- ntpclients/ntpmon
Changes:
=====================================
ntpclients/ntpmon
=====================================
--- a/ntpclients/ntpmon
+++ b/ntpclients/ntpmon
@@ -44,10 +44,11 @@ except ImportError as e:
sys.stderr.write("%s\n" % e)
sys.exit(1)
-
+disableunicode = False
# LANG=C or LANG=POSIX refuse unicode when combined with curses
if "UTF-8" != sys.stdout.encoding:
ntp.util.deunicode_units()
+ disableunicode = True
try:
@@ -170,7 +171,11 @@ class Fatal(Exception):
class OutputContext:
def __enter__(self):
"Begin critical region."
- locale.setlocale(locale.LC_ALL, 'C.UTF-8')
+ if (sys.version_info[0] < 3) and (disableunicode is False):
+ # This appears to only be needed under python 2, it is only
+ # activated when we already have UTF-8. Otherwise we drop
+ # down to non-unicode versions.
+ locale.setlocale(locale.LC_ALL, "")
global stdscr
stdscr = curses.initscr()
try:
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/b80ddd460fbb5621c43567f2d4577e058ecd065f
---
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/b80ddd460fbb5621c43567f2d4577e058ecd065f
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20170929/492e4868/attachment.html>
More information about the vc
mailing list