diff options
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> | 2018-06-07 14:42:14 +0200 |
---|---|---|
committer | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> | 2018-06-07 14:42:14 +0200 |
commit | e846825fc812cdf48717dd1c156d430101e2f5d0 (patch) | |
tree | 44fcd031feddf55d721ac888b82936cf3e0a8919 /poezio/poezio.py | |
parent | 0319ce5079bffec5cad9637ee396d489194d63e7 (diff) | |
download | poezio-e846825fc812cdf48717dd1c156d430101e2f5d0.tar.gz poezio-e846825fc812cdf48717dd1c156d430101e2f5d0.tar.bz2 poezio-e846825fc812cdf48717dd1c156d430101e2f5d0.tar.xz poezio-e846825fc812cdf48717dd1c156d430101e2f5d0.zip |
Add a check for Unicode support.
This makes poezio refuse to run if the environment is known broken.
Diffstat (limited to 'poezio/poezio.py')
-rw-r--r-- | poezio/poezio.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/poezio/poezio.py b/poezio/poezio.py index 841e706f..d74eca74 100644 --- a/poezio/poezio.py +++ b/poezio/poezio.py @@ -53,6 +53,23 @@ def test_env(): return True +def test_unicode(): + import poopt + try: + poopt.wcswidth('✔') + except UnicodeError: + print("""\ +ERROR: The current system is misconfigured for Unicode. + +Check your locale setup, especially the $LANG environment variable and \ +whether it matches a locale built on your system. Also check that it is a \ +.UTF-8 locale, and not using some legacy encoding. + +Poezio is unable to display characters properly, so it will now exit.""") + return False + return True + + def main(): """ Entry point. |