From: E.Smith <31170571+azlm8t@users.noreply.github.com> Date: Sun, 23 Sep 2018 13:59:39 +0000 (+0100) Subject: python: Need to utf-8 decode our strings. X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=83e5235c011de2094551908405fdfe22eb4d73b2;p=thirdparty%2Ftvheadend.git python: Need to utf-8 decode our strings. --- diff --git a/lib/py/tvh/htsmsg.py b/lib/py/tvh/htsmsg.py index 9c925b3cc..a0001519d 100644 --- a/lib/py/tvh/htsmsg.py +++ b/lib/py/tvh/htsmsg.py @@ -174,7 +174,16 @@ def deserialize0(data, typ=HMF_MAP): name = data[:nlen] data = data[nlen:] if typ == HMF_STR: - item = data[:dlen] + # All of our strings _should_ be utf-8 + # so need to decode them, otherwise + # everything looks fine until you + # substr the string elsewhere and + # get truncated characters and len is + # wrong. + try: + item = data[:dlen].decode('utf-8') + except: + item = data[:dlen] elif typ == HMF_BIN: item = HMFBin(data[:dlen]) elif typ == HMF_S64: