diff --git a/evennia/server/portal/telnet.py b/evennia/server/portal/telnet.py index 74aa9721cf..751745ce6f 100644 --- a/evennia/server/portal/telnet.py +++ b/evennia/server/portal/telnet.py @@ -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)) diff --git a/evennia/server/session.py b/evennia/server/session.py index 5481860163..002f8db7b3 100644 --- a/evennia/server/session.py +++ b/evennia/server/session.py @@ -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.