mirror of
https://github.com/corpnewt/gibMacOS.git
synced 2024-09-20 01:30:33 +00:00
Force StringIO in lieu of cStringIO
This commit is contained in:
parent
7333fdb330
commit
7072baa61e
1 changed files with 6 additions and 2 deletions
|
@ -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():
|
||||
|
|
Loading…
Reference in a new issue