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:
Gerko de Roo 2010-01-31 17:58:48 +01:00
parent e9f3769cd4
commit 4636e244ea

View File

@ -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