Skip to content

unicode unequal comparison error in person name #16

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
kercos opened this issue Nov 19, 2015 · 2 comments
Open

unicode unequal comparison error in person name #16

kercos opened this issue Nov 19, 2015 · 2 comments

Comments

@kercos
Copy link
Owner

kercos commented Nov 19, 2015

I 14:23:50.287 {u'message': {u'date': 1447939430, u'text': u'START', u'from': {u'first_name': u'Niccol\xf2', u'id': 132293896}, u'message_id': 28543, u'chat': {u'first_name': u'Niccol\xf2', u'type': u'private', u'id': 132293896}}, u'update_id': 436464105}
E 14:23:50.315 /base/data/home/apps/s~pickmeup-telegram/5.388676785424653775/main.py:260: UnicodeWarning: Unicode unequal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
E 14:23:50.315 if (p.name != name):
@anbasile
Copy link

Try this:

if p.name.decode('utf-8') != name.decode('utf-8'):

@kercos
Copy link
Owner Author

kercos commented Nov 20, 2015

grazie, ho provato. La soluzione sembra risolvere il problema se uno cambia il nome aggiungendo un accento (e.g., Federico -> Federicò) ma non il contrario. Il problema che sorge è il seguente:
File "/base/data/home/runtimes/python27/python27_dist/lib/python2.7/encodings/utf_8.py", line 16, in decode return codecs.utf_8_decode(input, errors, True) UnicodeEncodeError: 'ascii' codec can't encode character u'\xe0' in position 6: ordinal not in range(128)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants