Merge branch 'fix-accents' of https://github.com/vincent-lg/evennia into vincent-lg-fix-accents

This commit is contained in:
Griatch 2019-01-15 21:04:22 +01:00
commit 9245e47d07
2 changed files with 4 additions and 4 deletions

View file

@ -243,7 +243,7 @@ class TelnetProtocol(Telnet, StatefulTelnetProtocol, Session):
line (str): Line to send.
"""
line = self.try_encode(line)
line = self.encode_output(line)
# escape IAC in line mode, and correctly add \r\n (the TELNET end-of-line)
line = line.replace(IAC, IAC + IAC)
line = line.replace(b'\n', b'\r\n')
@ -343,7 +343,7 @@ class TelnetProtocol(Telnet, StatefulTelnetProtocol, Session):
strip_ansi=nocolor, xterm256=xterm256)
if mxp:
prompt = mxp_parse(prompt)
prompt = self.try_encode(prompt)
prompt = self.encode_output(prompt)
prompt = prompt.replace(IAC, IAC + IAC).replace(b'\n', b'\r\n')
prompt += IAC + GA
self.transport.write(mccp_compress(self, prompt))

View file

@ -137,9 +137,9 @@ class Session(object):
# helpers
def try_encode(self, text):
def encode_output(self, text):
"""
Try to encode the given text, following the session's protocol flag.
Encode the given text for output, following the session's protocol flag.
Args:
text (str or bytes): the text to encode to bytes.