15
0
forked from pool/python-emoji
Files
python-emoji/fix-python2.patch

23 lines
934 B
Diff
Raw Normal View History

From: Matthias Bach <marix@marix.org>
Date: 2021-07-31 11:57:53 2021 +0200
Subject: Fix matching of non-ASCII emoji names on Python 2
References: https://github.com/carpedm20/emoji/pull/181
Upstream: merged
A fix to get the tests passing for the French language in 1.4.1 sadly was incomplete and only worked for Python 3. This extends the patch to also work on Python 2.
diff --git a/emoji/core.py b/emoji/core.py
index 7221937..ade232e 100644
--- a/emoji/core.py
+++ b/emoji/core.py
@@ -55,7 +55,7 @@ def emojize(
Python is fun ❤️ #red heart, not black heart
"""
EMOJI_UNICODE = unicode_codes.EMOJI_UNICODE[language]
- pattern = re.compile(u'(%s[\\w\\-&.’”“()!#*+?,/]+%s)' % delimiters)
+ pattern = re.compile(u'(%s[\\w\\-&.’”“()!#*+?,/]+%s)' % delimiters, flags=re.UNICODE)
def replace(match):
mg = match.group(1).replace(delimiters[0], _DEFAULT_DELIMITER).replace(