[orca] Fix for bug 671198 - UnicodeEncodeError and UnicodeDecodeError when presenting information
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Fix for bug 671198 - UnicodeEncodeError and UnicodeDecodeError when presenting information
- Date: Fri, 2 Mar 2012 11:55:24 +0000 (UTC)
commit 107bc534fcc3abfe1242e34d3f462392ae75938a
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Fri Mar 2 06:53:41 2012 -0500
Fix for bug 671198 - UnicodeEncodeError and UnicodeDecodeError when presenting information
src/orca/braille.py | 15 ++++++++++++---
src/orca/speech.py | 9 +++++----
2 files changed, 17 insertions(+), 7 deletions(-)
---
diff --git a/src/orca/braille.py b/src/orca/braille.py
index d30bcaf..994ea5a 100644
--- a/src/orca/braille.py
+++ b/src/orca/braille.py
@@ -607,11 +607,20 @@ class Text(Region):
self.caretOffset = 0
self.lineOffset = 0
- string = string.decode("UTF-8")
+ try:
+ string = string.decode("UTF-8")
+ except UnicodeEncodeError:
+ pass
if label:
- label = label.decode("UTF-8")
+ try:
+ label = label.decode("UTF-8")
+ except UnicodeEncodeError:
+ pass
if eol:
- eol = eol.decode("UTF-8")
+ try:
+ eol = eol.decode("UTF-8")
+ except UnicodeEncodeError:
+ pass
try:
endOffset = endOffset - self.lineOffset
diff --git a/src/orca/speech.py b/src/orca/speech.py
index 0796e92..5d35eee 100644
--- a/src/orca/speech.py
+++ b/src/orca/speech.py
@@ -246,10 +246,11 @@ def speak(content, acss=None, interrupt=True):
newItemsToSpeak.append(toSpeak.pop())
if toSpeak:
- try:
- toSpeak = map(lambda x: x.decode("UTF-8"), toSpeak)
- except UnicodeEncodeError:
- pass
+ for i, item in enumerate(toSpeak):
+ try:
+ toSpeak[i] = item.decode("UTF-8")
+ except UnicodeEncodeError:
+ pass
string = " ".join(toSpeak)
_speak(string, activeVoice, interrupt)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]