Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/activity.py
diff options
context:
space:
mode:
authorAleksey Lim <alsroot@sugarlabs.org>2012-02-28 22:18:16 (GMT)
committer Aleksey Lim <alsroot@sugarlabs.org>2012-02-28 22:18:37 (GMT)
commitc02aca65850836d4a8bcee1e730e21927e12051c (patch)
tree47b15dfe1c5b24afa6165be31d8a37796bde98ce /activity.py
parenta0f14888003c812b3fa95d8db30233943a31b0d5 (diff)
Fix pronunciation of unicode strings; keep history in unicode (Gonzalo Odiard)
Diffstat (limited to 'activity.py')
-rw-r--r--activity.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/activity.py b/activity.py
index ee00da9..3e85c24 100644
--- a/activity.py
+++ b/activity.py
@@ -210,16 +210,18 @@ class SpeakActivity(SharedActivity):
self.eye_shape_combo.select(status.eyes[0])
self.numeyesadj.value = len(status.eyes)
- self.entry.props.text = cfg['text']
+ self.entry.props.text = cfg['text'].encode('utf-8', 'ignore')
for i in cfg['history']:
- self.entrycombo.append_text(i)
+ self.entrycombo.append_text(i.encode('utf-8', 'ignore'))
self.new_instance()
def save_instance(self, file_path):
cfg = {'status': self.face.status.serialize(),
- 'text': self.entry.props.text,
- 'history': map(lambda i: i[0], self.entrycombo.get_model())}
+ 'text': unicode(self.entry.props.text, 'utf-8', 'ignore'),
+ 'history': [unicode(i[0], 'utf-8', 'ignore') \
+ for i in self.entrycombo.get_model()],
+ }
file(file_path, 'w').write(cjson.encode(cfg))
def share_instance(self, connection, is_initiator):