Skip to content

Commit

Permalink
Set errors='backslashreplace' on whatever charset user has chosen (#1067
Browse files Browse the repository at this point in the history
)

User can set GAM_CHARSET; default is UTF8
  • Loading branch information
taers232c authored and jay0lee committed Jan 2, 2020
1 parent 75eec07 commit 08e790e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/gam.py
Original file line number Diff line number Diff line change
Expand Up @@ -13933,6 +13933,9 @@ def ProcessGAMCommand(args):
GM_Globals[GM_SYSEXITRC] = 0
try:
SetGlobalVariables()
if sys.version_info[1] >= 7:
sys.stdout.reconfigure(encoding=GC_Values[GC_CHARSET], errors='backslashreplace')
sys.stdin.reconfigure(encoding=GC_Values[GC_CHARSET], errors='backslashreplace')
command = sys.argv[1].lower()
if command == 'batch':
i = 2
Expand Down Expand Up @@ -14741,7 +14744,4 @@ def ProcessGAMCommand(args):
mp_set_start_method('fork')
if sys.version_info[0] < 3 or sys.version_info[1] < 5:
controlflow.system_error_exit(5, 'GAM requires Python 3.5 or newer. You are running %s.%s.%s. Please upgrade your Python version or use one of the binary GAM downloads.' % sys.version_info[:3])
elif sys.version_info[1] >= 7:
sys.stdout.reconfigure(encoding=UTF8, errors='backslashreplace')
sys.stdin.reconfigure(encoding=UTF8, errors='backslashreplace')
sys.exit(ProcessGAMCommand(sys.argv))

0 comments on commit 08e790e

Please sign in to comment.