summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--poezio/__main__.py4
-rw-r--r--poezio/poezio.py17
2 files changed, 19 insertions, 2 deletions
diff --git a/poezio/__main__.py b/poezio/__main__.py
index 1f46f051..d6f60f24 100644
--- a/poezio/__main__.py
+++ b/poezio/__main__.py
@@ -1,7 +1,7 @@
def run():
- from poezio.poezio import main, test_curses, test_env
+ from poezio.poezio import main, test_curses, test_env, test_unicode
- if not test_curses() or not test_env():
+ if not test_curses() or not test_env() or not test_unicode():
import sys
sys.exit(1)
else:
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.