Topics

Is there a way to pass unicode text to NVDA?

 

Hello everyone,

Currently I'm trying to create some scripts for NVDA to suit my personal needs.
During that I have come to the following problem: in lithuanian
language, there are some unicode characters like ą, č, ę, ė, į, š, ų
and ū. In my task I want NVDA to process these characters during
speech. I have experiencing two differennt issues here:
ui.message('ą-č-ę-ė-į-š-ų-ū'):
-> KeyError: \xb3
However, the following output:
ui.message(u'ą-č-ę-ė-į-š') works great.
The 2nd example:
ui.message('šeima') # "Family" meaning in lithuanian
-> UnicodeDecodeError: 'ascii' codec can't decode byte 0xc5 in
position 0: ordinal not in range(128)
And again, >>> ui.message(u'šeima') is also correct.
Here my question is: is it possible to make NVDA speaking this type of
unicode charrs (when they are in a variable)?
text = 'šeima'
Thanks in advance.
Sincerely,
Paulius

Tom Kingston
 

Hi Paulius,

All you need to do is the same for variables as for literals.
text = u'unicode text'
You can confirm in the console with type(variable)
It will return str or unicode.

Regards,
Tom

On 6/22/2019 9:31 AM, Paulius wrote:
Hello everyone,
Currently I'm trying to create some scripts for NVDA to suit my personal needs.
During that I have come to the following problem: in lithuanian
language, there are some unicode characters like ą, č, ę, ė, į, š, ų
and ū. In my task I want NVDA to process these characters during
speech. I have experiencing two differennt issues here:
ui.message('ą-č-ę-ė-į-š-ų-ū'):
-> KeyError: \xb3
However, the following output:
ui.message(u'ą-č-ę-ė-į-š') works great.
The 2nd example:
ui.message('šeima') # "Family" meaning in lithuanian
-> UnicodeDecodeError: 'ascii' codec can't decode byte 0xc5 in
position 0: ordinal not in range(128)
And again, >>> ui.message(u'šeima') is also correct.
Here my question is: is it possible to make NVDA speaking this type of
unicode charrs (when they are in a variable)?
text = 'šeima'
Thanks in advance.
Sincerely,
Paulius