Page 1 of 1

Fail on Unicode

Posted: 19.11.2015 10:31
by Vlek
An annoying issue I'm having with unicode characters is not being able to use them. I can't print them to system journal, nor can I print them in game even if UO can handle them. I have seen in the Russian forums that this has been an issue for a few people already in the Asian community, and I was not able to figure out whether it was addressed. It seems that, when stealth attempts to use what's passed into the functions UOSay or AddToSystemJournal, it attempts to encode it using ASCII. When that fails, it either causes stealth to crash or complain.

I believe this issue may also shed some light on PartySay and how it is horribly mangled. Instead of using ASCII, it seems to want to encode the passed string as something completely different which causes it to bug out. I'll have to investigate it further and make a post specifically about that though.

This is the code I'm using:

Code: Select all

import stealth

stealth.UOSay(u'\u2660')
This is the error I'm getting:

Code: Select all

(file path) line 3, in <module>
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2660' in position 0: ordinal not in range(128)

Re: Fail on Unicode

Posted: 19.11.2015 12:41
by Vizit0r
really, thats python error, not stealth.

try use stealth.UOSay(u'\2660');

Re: Fail on Unicode

Posted: 19.11.2015 22:19
by Vlek
I tried that, and I get the same error message:

Code: Select all

(file location) line 3, in <module>
UnicodeEncodeError: 'ascii' codec can't encode character u'\xb6' in position 0: ordinal not in range(128)
I swear it's a problem with how stealth handles strings. It's trying to encode or deal with them like they are ASCII encoded.

Re: Fail on Unicode

Posted: 21.11.2015 10:38
by Vizit0r
thats python raise you error. At this moment Stealth handles nothing - he didnt receive string from Py.


Seems like need to use unicode Py 3.X or unicode modules (in 2.7) - i dont know.