GNOME Bugzilla – Bug 462475
crash due Non-ASCII characters in .orca/user-settings.py file
Last modified: 2007-08-07 18:44:27 UTC
I was trying to reproduce the bug #462044 and after installing gnome-mag and orca from trunk I get the following error trying to running orca: GTK Accessibility Module initialized Traceback (most recent call last):
+ Trace 152076
init(registry)
loadUserSettings()
_userSettings = __import__("user-settings")
The content of line 121 is: orca.pronunciation_dict.pronunciation_dict["ASAP"]="o mais cedo possível" translating the string to english, it's something like "the earlier possible"
I'm not quite exactly sure what should be done to resolve this - the link mentioned in the bug opener seems to give some information, but I'm not sure exactly what the right thing to do is. Rich, I'm going to give this one to you. :-)
I'd already started looking at it. ;-) Adding the following line, as the very first line in ~/.orca/user-settings.py seems to fix the problem. # -*- coding: latin-1 -*- Will, does that seem the right thing to do?
If this is the correct fix, it would also have to be the first line of any ~/.orca/app-settings/<appname>.py files too.
> # -*- coding: latin-1 -*- > > Will, does that seem the right thing to do? I'm not sure. :-( The reason being is that we might end up saving things for non-latin-1 locales, like Chinese. I wonder if there is a way to ask Python for the coding that's currently in use when we write out the file?
I'm not finding how to ask Python for the coding that is currently in use. There must be a way, I'm just not finding it by googling around. But having said that, isn't there something that we can output that will act like a superset of all the possible character encodings we might encounter? For example, adding the following line: # This Python file uses the following encoding: utf-8 at the top of ~/.orca/user-settings.py (instead of the previous one), also fixes the problem for the "o mais cedo possível" example. No SyntaxError and the TTS engine nicely spoke the Latin characters. I then changed the lines in user-settings.py to: orca.pronunciation_dict.pronunciation_dict["ASAP"]="look chinese chars: 请你不要 哭" and there was no SyntaxError at Orca startup time. The TTS couldn't speak 'em, but that's a separate problem.
Created attachment 92880 [details] [review] Patch to fix the problem. This seems to work nicely.
Patch committed to gnome-2-20 branch and HEAD. Put the bug into a "[pending]" state.
I just tested the latest orca with the above example and orca seemed to start just fine.
Thanks Mike. Closing as FIXED.