Converted encoding setting to use protocol_flags rather than being stored on-session. Also renamed the 256 COLORS TTYPE setting to XTERM256 which is more accurate (and doesn't have a space)

This commit is contained in:
Griatch 2016-03-25 13:01:21 +01:00
parent 1ddfbca7ea
commit 11ecdef7c8
8 changed files with 39 additions and 29 deletions

View file

@ -168,11 +168,11 @@ class SessionHandler(dict):
elif isinstance(data, basestring):
# make sure strings are in a valid encoding
try:
data = data and to_str(to_unicode(data), encoding=session.encoding)
data = data and to_str(to_unicode(data), encoding=session.protocol_flags["ENCODING"])
except LookupError:
# wrong encoding set on the session. Set it to a safe one
session.encoding = "utf-8"
data = to_str(to_unicode(data), encoding=session.encoding)
session.protocol_flags["ENCODING"] = "utf-8"
data = to_str(to_unicode(data), encoding=session.protocol_flags["ENCODING"])
if _INLINEFUNC_ENABLED and not raw:
data = parse_inlinefunc(data, strip=strip_inlinefunc, session=session) # deprecated!
data = parse_nested_inlinefunc(data, strip=strip_inlinefunc, session=session)