[orca] Additional fix for bug 659122 - Orca 3.1.91 and master version producing unicode decode error traceb



commit 195694f304f73d1bbbc86bb6012743e4d34ea609
Author: Joanmarie Diggs <joanmarie diggs gmail com>
Date:   Thu Sep 15 09:20:36 2011 -0400

    Additional fix for bug 659122 - Orca 3.1.91 and master version producing unicode decode error traceback with speech generation if I using hungarian locale

 src/orca/script_utilities.py |   24 ++++++++++++++++++++----
 1 files changed, 20 insertions(+), 4 deletions(-)
---
diff --git a/src/orca/script_utilities.py b/src/orca/script_utilities.py
index 64dfde7..0bd54f2 100644
--- a/src/orca/script_utilities.py
+++ b/src/orca/script_utilities.py
@@ -2326,6 +2326,16 @@ class Utilities:
         import punctuation_settings
         import chnames
 
+        try:
+            line = line.decode("UTF-8")
+        except UnicodeEncodeError:
+            pass
+
+        try:
+            segment = segment.decode("UTF-8")
+        except UnicodeEncodeError:
+            pass
+
         style = settings.verbalizePunctuationStyle
         isPunctChar = True
         try:
@@ -2343,11 +2353,17 @@ class Utilities:
                 # space characters".  The %d is the number and the %s
                 # is the spoken word for the character.
                 #
-                line += " " \
-                     + ngettext("%(count)d %(repeatChar)s character",
+                repeatSegment = ngettext("%(count)d %(repeatChar)s character",
                                 "%(count)d %(repeatChar)s characters",
-                                count) \
-                       % {"count" : count, "repeatChar": repeatChar}
+                                 count) \
+                                 % {"count" : count, "repeatChar": repeatChar}
+
+                try:
+                    repeatSegment = repeatSegment.decode("UTF-8")
+                except UnicodeEncodeError:
+                    pass
+
+                line = "%s %s" % (line, repeatSegment)
             else:
                 line += segment
         else:



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]