gntp icon indicating copy to clipboard operation
gntp copied to clipboard

Fix unicode messages

Open Ameriks opened this issue 12 years ago • 5 comments

There was problem with unicode messages. That is fixed by verifying that incoming variable is basestring (not str) and in case it is not, then we convert variable to unicode (not to str).

Ameriks avatar Jul 22 '13 11:07 Ameriks

Thanks for the catch. Which version of Python were you using ? Did you run the unit tests through Tox to test all the versions? I'll try to run through the tests myself sometime this week.

kfdm avatar Jul 22 '13 14:07 kfdm

Sorry, I didn't run tests on all versions, but basestring was first introduced in version 2.3, but it is no longer available in Python 3.

I will update code to pass in all versions of python you have defined in Tox.

Ameriks avatar Jul 22 '13 14:07 Ameriks

I know the Six library does a few things to check basestring vs str

https://bitbucket.org/gutworth/six/src/e3da7fd96039a6ed89493f89d121c4f3797e6713/six.py?at=default#cl-35

Not sure how we would want to do this here without poking at it some myself. I wonder why it wasn't caught by my existing unicode test

https://github.com/kfdm/gntp/blob/master/gntp/test/basic_tests.py#L47

Do you have an example message that failed ?

kfdm avatar Jul 22 '13 14:07 kfdm

I'm pretty sure that this will fail, but I was using different text: u"Šaursliežu dzelzceļš"

Ameriks avatar Jul 22 '13 14:07 Ameriks

BTW, I didn't use six library, but instead try except. I didn't test it with Tox as I don't have it installed.

Let me know if there is anything else I can help.

Ameriks avatar Jul 22 '13 14:07 Ameriks