Codec errors seem to lock up HUD with windows.
I've made a trap for each error that I observed. don't want to halt the program so I return the original string. The de/recoding is not needed for >95% of the playernames anyway.
This commit is contained in:
parent
e9f3769cd4
commit
4636e244ea
|
@ -41,7 +41,13 @@ def to_utf8(s):
|
|||
return _out
|
||||
except UnicodeDecodeError:
|
||||
sys.stderr.write('Could not convert: "%s"\n' % s)
|
||||
raise
|
||||
return s
|
||||
except UnicodeEncodeError:
|
||||
sys.stderr.write('Could not convert: "%s"\n' % s)
|
||||
return s
|
||||
except TypeError:
|
||||
sys.stderr.write('Could not convert: "%s"\n' % s)
|
||||
return s
|
||||
|
||||
def to_db_utf8(s):
|
||||
if not_needed2: return s
|
||||
|
@ -51,7 +57,13 @@ def to_db_utf8(s):
|
|||
return _out
|
||||
except UnicodeDecodeError:
|
||||
sys.stderr.write('Could not convert: "%s"\n' % s)
|
||||
raise
|
||||
return s
|
||||
except UnicodeEncodeError:
|
||||
sys.stderr.write('Could not convert: "%s"\n' % s)
|
||||
return s
|
||||
except TypeError:
|
||||
sys.stderr.write('Could not convert: "%s"\n' % s)
|
||||
return s
|
||||
|
||||
def to_gui(s):
|
||||
if not_needed3: return s
|
||||
|
@ -61,5 +73,11 @@ def to_gui(s):
|
|||
return _out
|
||||
except UnicodeDecodeError:
|
||||
sys.stderr.write('Could not convert: "%s"\n' % s)
|
||||
raise
|
||||
return s
|
||||
except UnicodeEncodeError:
|
||||
sys.stderr.write('Could not convert: "%s"\n' % s)
|
||||
return s
|
||||
except TypeError:
|
||||
sys.stderr.write('Could not convert: "%s"\n' % s)
|
||||
return s
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user