Solve the accentuation problem in Evennia (Python 3)

This commit is contained in:
Vincent Le Goff 2019-01-12 15:27:36 +01:00
parent 844b04adbb
commit 49eb2b2873
4 changed files with 40 additions and 5 deletions

View file

@ -243,7 +243,7 @@ class TelnetProtocol(Telnet, StatefulTelnetProtocol, Session):
line (str): Line to send.
"""
line = bytes(line, 'utf-8')
line = self.try_encode(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 = prompt.encode()
prompt = self.try_encode(prompt)
prompt = prompt.replace(IAC, IAC + IAC).replace(b'\n', b'\r\n')
prompt += IAC + GA
self.transport.write(mccp_compress(self, prompt))