Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWalter Bender <walter.bender@gmail.com>2012-06-30 15:28:16 (GMT)
committer Walter Bender <walter.bender@gmail.com>2012-06-30 15:28:16 (GMT)
commit807ca1da501e9ab412e799ede4b88b74d6dd9ed8 (patch)
tree063db7a52dd24083946cc095485f52a80d4d3002
parentb34197d73824609a29af1af2b2249d532d5f7ede (diff)
fix problem with unicode encoding that prevented sharing
-rw-r--r--TurtleArt/tacollaboration.py2
-rw-r--r--TurtleArt/tautils.py11
2 files changed, 6 insertions, 7 deletions
diff --git a/TurtleArt/tacollaboration.py b/TurtleArt/tacollaboration.py
index d4798df..78dfbd3 100644
--- a/TurtleArt/tacollaboration.py
+++ b/TurtleArt/tacollaboration.py
@@ -204,7 +204,7 @@ class Collaboration():
command, payload = event_message.split('|', 2)
self._processing_methods[command](payload)
except ValueError:
- debug_output('Could not split event message.',
+ debug_output('Could not split event message [%s]' % event_message,
self._tw.running_sugar)
# Restore active Turtle
diff --git a/TurtleArt/tautils.py b/TurtleArt/tautils.py
index d60884e..e24d061 100644
--- a/TurtleArt/tautils.py
+++ b/TurtleArt/tautils.py
@@ -237,13 +237,12 @@ def data_from_string(text):
''' JSON load data from a string. '''
if type(text) == str:
return json_load(text.replace(']],\n', ']], '))
+ elif type(text) == unicode:
+ text = text.encode('ascii', 'replace')
+ return json_load(text.replace(']],\n', ']], '))
else:
- print type(text), text
- if hasattr('replace', text):
- return json_load(text.replace(']],\n', ']], '))
- else:
- print 'type error in data_from_string'
- return ''
+ print 'type error (%s) in data_from_string' % (type(text))
+ return None
def data_to_file(data, ta_file):
''' Write data to a file. '''