Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/TurtleArt/tautils.py
diff options
context:
space:
mode:
authorWalter Bender <walter@sugarlabs.org>2013-09-23 19:58:23 (GMT)
committer Walter Bender <walter@sugarlabs.org>2013-09-23 19:58:23 (GMT)
commit2700fc55e3848afb33bd919f684b9a65de784038 (patch)
tree746e69cd282e5e3e04748f08c3ae0122c9ca611c /TurtleArt/tautils.py
parentb6ba9c8cc0b56b9c154e2837abfeda75fd7db3da (diff)
use utf-8 encoding for unicode strings
Diffstat (limited to 'TurtleArt/tautils.py')
-rw-r--r--TurtleArt/tautils.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/TurtleArt/tautils.py b/TurtleArt/tautils.py
index 07b72d9..b0aa368 100644
--- a/TurtleArt/tautils.py
+++ b/TurtleArt/tautils.py
@@ -186,7 +186,7 @@ def find_hat(data):
def _to_str(text):
''' Convert whatever to a str type '''
if isinstance(text, unicode):
- return text.encode('ascii', 'replace')
+ return text.encode('utf-8')
elif isinstance(text, str):
return text
else:
@@ -371,7 +371,7 @@ def data_from_string(text):
if isinstance(text, str):
return json_load(text.replace(']],\n', ']], '))
elif isinstance(text, unicode):
- text = text.encode('ascii', 'replace')
+ text = text.encode('utf-8')
return json_load(text.replace(']],\n', ']], '))
else:
print 'type error (%s) in data_from_string' % (type(text))
@@ -415,7 +415,7 @@ def save_picture(canvas, file_name):
cr.set_source_surface(x_surface)
cr.paint()
if isinstance(file_name, unicode):
- img_surface.write_to_png(str(file_name.encode('ascii', 'replace')))
+ img_surface.write_to_png(str(file_name.encode('utf-8')))
else:
img_surface.write_to_png(str(file_name))