txtp_maker: tweak

This commit is contained in:
bnnm 2023-10-14 12:55:44 +02:00
parent 8cbd7ad32a
commit cc29ab1058

View File

@ -185,8 +185,11 @@ class TxtpInfo(object):
def _get_text(self, str): def _get_text(self, str):
text = self._get_string(str, full=True) text = self._get_string(str, full=True)
# stream names in CLI is printed as UTF-8 using '\xNN', so detect and transform # stream names in CLI is printed as UTF-8 using '\xNN', so detect and transform
if text and '\\' in text: try:
return text.encode('ascii').decode('unicode-escape').encode('iso-8859-1').decode('utf-8') if text and '\\' in text:
return text.encode('ascii').decode('unicode-escape').encode('iso-8859-1').decode('utf-8')
except:
return text #odd/buggy names
return text return text
def _get_value(self, str): def _get_value(self, str):