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-Tag: v4.2.7~32 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ecbc0d36e36b193210bfb775c551a7786eb60eaa;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: