@@ -488,8 +488,9 @@ def _format_command(self, argv):
488488 """
489489 result = []
490490 for arg in argv :
491- # if PY2 and is_unicode(arg):
492- # arg = arg.encode(encoding.OUTPUT_ENCODING) # DEBUG "utf-8")
491+ if PY2 and is_unicode (arg ):
492+ arg = arg .encode (encoding .CONSOLE_ENCODING ) # DEBUG "utf-8")
493+ # print("DEBUG: PY2 unicode args %s" % arg)
493494 if "'" in arg or " " in arg or "&" in arg :
494495 # for windows, if there are spaces we need to use
495496 # double quotes. Single quotes cause problems
@@ -521,14 +522,20 @@ def _AppendText(self, textctrl, string, source="stdout"):
521522 try :
522523 if PY2 :
523524 # textctrl.AppendText(string.encode(encoding.OUTPUT_ENCODING)) # DEBUG encoding.CONSOLE_ENCODING)) # DEBUG 'utf-8'))
524- textctrl .AppendText (string .encode ('utf-8' )) # encoding.SYSTEM_ENCODING))
525+ textctrl .AppendText (string .encode (encoding . SYSTEM_ENCODING )) # encoding.SYSTEM_ENCODING)) 'utf-8'
525526 else :
526527 textctrl .AppendText (str (string )) # DEBUG
527528 except UnicodeDecodeError as e :
528529 # I'm not sure why I sometimes get this, and I don't know what I
529530 # can do other than to ignore it.
530531 textctrl .AppendTextRaw (bytes (string )) # DEBUG .encode('utf-8'))
531- # print("DEBUG UnicodeDecodeError appendtext string=%s\n" % string)
532+ # print(r"DEBUG UnicodeDecodeError appendtext string=%s\n" % string)
533+ pass
534+ except UnicodeEncodeError as e :
535+ # I'm not sure why I sometimes get this, and I don't know what I
536+ # can do other than to ignore it.
537+ textctrl .AppendText (string .encode ('utf-8' )) # DEBUG .encode('utf-8'))
538+ # print(r"DEBUG UnicodeDecodeError appendtext string=%s\n" % string)
532539 pass
533540 # raise # DEBUG
534541
0 commit comments