From b57608cf556819ddb15c6c355188f85abff63b4d Mon Sep 17 00:00:00 2001 From: Greg Taylor Date: Tue, 27 Oct 2009 20:03:03 +0000 Subject: [PATCH] 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. --- sitecustomize.py | 11 +++++++++++ src/session.py | 6 ------ 2 files changed, 11 insertions(+), 6 deletions(-) create mode 100644 sitecustomize.py diff --git a/sitecustomize.py b/sitecustomize.py new file mode 100644 index 0000000000..1d199caf7d --- /dev/null +++ b/sitecustomize.py @@ -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') \ No newline at end of file diff --git a/src/session.py b/src/session.py index 2f2868b130..f307dc9662 100755 --- a/src/session.py +++ b/src/session.py @@ -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)