Skip to content

Fix emojis on py3 #24

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

Merged
merged 1 commit into from
Aug 8, 2015
Merged

Fix emojis on py3 #24

merged 1 commit into from
Aug 8, 2015

Conversation

franciscod
Copy link
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
Member

Nice catch. Thank you!

@franciscod
Copy link
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
Member

jh0ker commented Oct 23, 2015

from __future__ import unicode_literals

Well now I feel stupid about #85 😁

@franciscod
Copy link
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
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy