This fixes issue #569

This commit is contained in:
lu yijun 2014-09-07 02:22:12 +08:00
parent 46781d3ee1
commit dbbacb4bb3
6 changed files with 82 additions and 13 deletions

View file

@ -364,7 +364,7 @@ class AMPProtocol(amp.AMP):
"""
#print "msg portal->server (portal side):", sessid, msg, data
return self.safe_send(MsgPortal2Server, sessid,
msg=to_str(msg) if msg is not None else "",
msg=msg if msg is not None else "",
data=dumps(data))
# Server -> Portal message
@ -389,7 +389,7 @@ class AMPProtocol(amp.AMP):
"""
#print "msg server->portal (server side):", sessid, msg, data
return self.safe_send(MsgServer2Portal, sessid,
msg=to_str(msg) if msg is not None else "",
msg=msg if msg is not None else "",
data=dumps(data))
# Server administration from the Portal side

View file

@ -13,7 +13,7 @@ from django.conf import settings
#from src.scripts.models import ScriptDB
from src.comms.models import ChannelDB
from src.utils import logger, utils
from src.utils.utils import make_iter, to_unicode, escape_control_sequences
from src.utils.utils import make_iter, to_unicode, to_str, escape_control_sequences
from src.commands.cmdhandler import cmdhandler
from src.commands.cmdsethandler import CmdSetHandler
from src.server.session import Session
@ -198,7 +198,7 @@ class ServerSession(Session):
"""
if text:
# this is treated as a command input
text = to_unicode(escape_control_sequences(text))
text = to_unicode(escape_control_sequences(text), encoding=self.encoding)
# handle the 'idle' command
if text.strip() == IDLE_COMMAND:
self.update_session_counters(idle=True)
@ -231,6 +231,12 @@ class ServerSession(Session):
"""
Send Evennia -> User
"""
if text is None:
text = ""
else:
text = to_unicode(text)
text = to_str(text, self.encoding)
self.sessionhandler.data_out(self, text=text, **kwargs)
def __eq__(self, other):