fix for a bug reported by itxx@qq.co​m (TypeError: encode() takes no keyword arguments)

This commit is contained in:
Miroslav Stampar 2011-05-14 19:57:28 +00:00
parent 053c245114
commit 3484a4426b
2 changed files with 2 additions and 2 deletions

View File

@ -647,7 +647,7 @@ def dataToStdout(data, forceOutput=False):
try: try:
# Reference: http://bugs.python.org/issue1602 # Reference: http://bugs.python.org/issue1602
if IS_WIN: if IS_WIN:
output = data.encode('ascii', errors="replace") output = data.encode('ascii', "replace")
if output != data: if output != data:
warnMsg = "cannot properly display Unicode characters " warnMsg = "cannot properly display Unicode characters "

View File

@ -137,7 +137,7 @@ def unicodeencode(value, encoding=None):
try: try:
retVal = value.encode(encoding or UNICODE_ENCODING) retVal = value.encode(encoding or UNICODE_ENCODING)
except UnicodeEncodeError: except UnicodeEncodeError:
retVal = value.encode(UNICODE_ENCODING, errors="replace") retVal = value.encode(UNICODE_ENCODING, "replace")
return retVal return retVal
def utf8encode(value): def utf8encode(value):