Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/tautils.py
diff options
context:
space:
mode:
authorWalter Bender <walter@walter-laptop.(none)>2010-02-22 20:01:10 (GMT)
committer Walter Bender <walter@walter-laptop.(none)>2010-02-22 20:01:10 (GMT)
commitb256fc61ac3d7841a39e5f2d5c6ec442246cc10b (patch)
tree31c290b322a82699d5727f7e01ff6edfe584a039 /tautils.py
parentf7e5c95b67408e71bb76a8a9025689d8e442e38c (diff)
strip newlines from json strings
Diffstat (limited to 'tautils.py')
-rw-r--r--tautils.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/tautils.py b/tautils.py
index d7cd903..8352980 100644
--- a/tautils.py
+++ b/tautils.py
@@ -46,7 +46,11 @@ def json_load(text):
if _old_Sugar_system is True:
listdata = json.read(text)
else:
- io = StringIO(text)
+ # strip out leading and trailing whitespace, nulls, and newlines
+ text = text.lstrip()
+ text = text.replace('\12','')
+ text = text.replace('\00','')
+ io = StringIO(text.rstrip())
listdata = jload(io)
# json converts tuples to lists, so we need to convert back,
return _tuplify(listdata)