From 7072baa61edec2699a7ef8f3560aad59a3f7bfad Mon Sep 17 00:00:00 2001 From: CorpNewt Date: Tue, 13 Nov 2018 09:42:16 -0600 Subject: [PATCH] Force StringIO in lieu of cStringIO --- Scripts/plist.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Scripts/plist.py b/Scripts/plist.py index 078ceb4..ae74125 100644 --- a/Scripts/plist.py +++ b/Scripts/plist.py @@ -4,6 +4,9 @@ import datetime from io import BytesIO +# Force use of StringIO instead of cStringIO as the latter +# has issues with Unicode strings +from StringIO import StringIO import os import plistlib import struct @@ -76,8 +79,9 @@ def loads(value, fmt=None, use_builtin_types=True, dict_type=dict): return readBinaryPlistFile(BytesIO(value)) else: # Is not binary - assume a string - and try to load - - return plistlib.readPlistFromString(value) + # We avoid using readPlistFromString() as that uses + # cStringIO and fails when Unicode strings are detected + return plistlib.readPlist(StringIO(value)) def dump(value, fp, fmt=FMT_XML, sort_keys=True, skipkeys=False): if _check_py3():