Skip to content

Commit 4e0a386

Browse files
authored
Merge pull request #2349 from SnoopJeDi/feature/optional-unicodedata2-support
unicode_info: Use unicodedata2, if available
2 parents eff60e9 + a430a62 commit 4e0a386

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

sopel/modules/unicode_info.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,14 @@
88
"""
99
from __future__ import annotations
1010

11-
import unicodedata
12-
1311
from sopel import plugin
1412

13+
# unicodedata2 can provide a more-modern UCD than the one that comes with Python, use it if present
14+
try:
15+
import unicodedata2 as unicodedata
16+
except ImportError:
17+
import unicodedata
18+
1519

1620
def get_codepoint_name(char):
1721
"""Retrieve the code point (and name, if possible) for a given character"""

0 commit comments

Comments
 (0)