Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detect utf-8 shell env in python3.8 #255

Open
wants to merge 2 commits into
base: devel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions aeneas/diagnostics.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ def check_shell_encoding(cls):
"""
is_in_utf8 = True
is_out_utf8 = True
if sys.stdin.encoding not in ["UTF-8", "UTF8"]:
if sys.stdin.encoding not in ["UTF-8", "UTF8", "utf-8", "utf8"]:
is_in_utf8 = False
if sys.stdout.encoding not in ["UTF-8", "UTF8"]:
if sys.stdout.encoding not in ["UTF-8", "UTF8", "utf-8", "utf8"]:
is_out_utf8 = False
if (is_in_utf8) and (is_out_utf8):
gf.print_success(u"shell encoding OK")
Expand Down
4 changes: 2 additions & 2 deletions aeneas/tools/abstract_cli_program.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,10 +295,10 @@ def run(self, arguments, show_help=True):
if self.use_sys:
# check that sys.stdin.encoding and sys.stdout.encoding are set to utf-8
if not gf.FROZEN:
if sys.stdin.encoding not in ["UTF-8", "UTF8"]:
if sys.stdin.encoding not in ["UTF-8", "UTF8", "utf-8", "utf8"]:
self.print_warning(u"The default input encoding is not UTF-8.")
self.print_warning(u"You might want to set 'PYTHONIOENCODING=UTF-8' in your shell.")
if sys.stdout.encoding not in ["UTF-8", "UTF8"]:
if sys.stdout.encoding not in ["UTF-8", "UTF8", "utf-8", "utf8"]:
self.print_warning(u"The default output encoding is not UTF-8.")
self.print_warning(u"You might want to set 'PYTHONIOENCODING=UTF-8' in your shell.")
# decode using sys.stdin.encoding
Expand Down