Set the default encoding to UTF-8. UTF-8 support in new codebases is pretty much expected, especially given that MUX/MUSH now have excellent support. This should alleviate some of those encoding errors, and allows us to get rid of that ascii error checker in session.py.

This commit is contained in:
Greg Taylor 2009-10-27 20:03:03 +00:00
parent eb6f82fea0
commit b57608cf55
2 changed files with 11 additions and 6 deletions

11
sitecustomize.py Normal file
View file

@ -0,0 +1,11 @@
"""
This file sets the default encoding for the codebase to
UTF-8 instead of ascii. This allows for just about any
language to be used in-game.
It is not advisable to change the value set below, as
there will be a lot of encoding errors that result in
server crashes.
"""
import sys
sys.setdefaultencoding('utf-8')

View file

@ -78,12 +78,6 @@ class SessionProtocol(StatefulTelnetProtocol):
Any line return indicates a command for the purpose of a MUD. So we take
the user input and pass it to this session's pobject.
"""
try:
test = u"%s" % data
except UnicodeDecodeError:
self.msg("Couldn't parse that - one or more characters were not recognized.")
return
if self.pobject:
# Session is logged in, run through the normal object execution.
self.pobject.execute_cmd(data, session=self)