X Tutup
Skip to content

Fix emojis on py3#24

Merged
leandrotoledo merged 1 commit intopython-telegram-bot:masterfrom
franciscod:py3-emoji
Aug 8, 2015
Merged

Fix emojis on py3#24
leandrotoledo merged 1 commit intopython-telegram-bot:masterfrom
franciscod:py3-emoji

Conversation

@franciscod
Copy link
Copy Markdown
Contributor

The py2 string literals are interpreted as bytes on py3, so emojis on py3 aren't working.

Using b'\xF0\x9F\x98\x81' instead of '\xF0\x9F\x98\x81' fixes it: it now works in both py2 and py3 (tested with 2.7.10 and 3.4.3)

leandrotoledo added a commit that referenced this pull request Aug 8, 2015
@leandrotoledo leandrotoledo merged commit af9acb3 into python-telegram-bot:master Aug 8, 2015
@leandrotoledo
Copy link
Copy Markdown
Member

Nice catch. Thank you!

@franciscod
Copy link
Copy Markdown
Contributor Author

Seeing #80 and #85, I think this was not the right solution: we often want to use emojis as strings, not as bytes...

Maybe we should revert this, and instead do something like:

from __future__ import unicode_literals

or its alternatives from here http://python-future.org/unicode_literals.html

Also, we should really have unit tests on these things for py2 and py3.

@jh0ker
Copy link
Copy Markdown
Member

jh0ker commented Oct 23, 2015

from __future__ import unicode_literals

Well now I feel stupid about #85 😁

@franciscod
Copy link
Copy Markdown
Contributor Author

Haha, it happens frequently; python has really clever solutions for some stuff :)

@github-actions github-actions bot locked and limited conversation to collaborators Aug 25, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

X Tutup