Add a check for Unicode support.
This makes poezio refuse to run if the environment is known broken.
This commit is contained in:
parent
0319ce5079
commit
e846825fc8
2 changed files with 19 additions and 2 deletions
|
@ -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:
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in a new issue