[orca] Another fix for bug #659122 - UnicodeDecodeError and UnicodeEncodeError keep cropping up since intro
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Another fix for bug #659122 - UnicodeDecodeError and UnicodeEncodeError keep cropping up since intro
- Date: Thu, 8 Dec 2011 17:21:11 +0000 (UTC)
commit bfbcf2faac9ecee2621f70cca39f8efc1c38e5bd
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Thu Dec 8 12:18:51 2011 -0500
Another fix for bug #659122 - UnicodeDecodeError and UnicodeEncodeError keep cropping up since introspection
Also corrected the fact that we were redefining the built-in 'format'
in generator.py.
src/orca/generator.py | 15 ++++++++++-----
src/orca/keynames.py | 7 ++++++-
2 files changed, 16 insertions(+), 6 deletions(-)
---
diff --git a/src/orca/generator.py b/src/orca/generator.py
index 77e411a..f9dd446 100644
--- a/src/orca/generator.py
+++ b/src/orca/generator.py
@@ -206,7 +206,7 @@ class Generator:
else:
args['formatType'] = 'unfocused'
- format = self._script.formatting.getFormat(**args)
+ formatting = self._script.formatting.getFormat(**args)
# Add in the context if this is the first time
# we've been called.
@@ -215,7 +215,7 @@ class Generator:
if args.get('includeContext', True):
prefix = self._script.formatting.getPrefix(**args)
suffix = self._script.formatting.getSuffix(**args)
- format = '%s + %s + %s' % (prefix, format, suffix)
+ formatting = '%s + %s + %s' % (prefix, formatting, suffix)
args['recursing'] = True
firstTimeCalled = True
else:
@@ -231,13 +231,13 @@ class Generator:
args['formatType'],
details,
repr(args),
- format))
+ formatting))
- assert(format)
+ assert(formatting)
while True:
currentTime = time.time()
try:
- result = eval(format, globalsDict)
+ result = eval(formatting, globalsDict)
break
except NameError:
result = []
@@ -912,6 +912,11 @@ class Generator:
if not displayedText:
return []
+ try:
+ displayedText = displayedText.decode('UTF-8')
+ except (UnicodeDecodeError, UnicodeEncodeError):
+ pass
+
return [displayedText]
#####################################################################
diff --git a/src/orca/keynames.py b/src/orca/keynames.py
index 88b8d93..1336da2 100644
--- a/src/orca/keynames.py
+++ b/src/orca/keynames.py
@@ -328,6 +328,11 @@ def localizeKeySequence(keys):
keyList = keys.split()
for key in keyList:
- keys = keys.replace(key, getKeyName(key))
+ keyName = getKeyName(key)
+ try:
+ keyName = keyName.decode("UTF-8")
+ except (UnicodeDecodeError, UnicodeEncodeError):
+ pass
+ keys = keys.replace(key, keyName)
return keys
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]