Back to Article
unicode.ipynb
Download Notebook
In [1]:
import unicodedata

def show_unicode_chars(text):
    for char in text:
        code_point = f"U+{ord(char):04X}"
        name = unicodedata.name(char)
        print(f"- {code_point} ({name}): {char}")

show_unicode_chars("Blakely: 67 🎉")
- U+0042 (LATIN CAPITAL LETTER B): B
- U+006C (LATIN SMALL LETTER L): l
- U+0061 (LATIN SMALL LETTER A): a
- U+006B (LATIN SMALL LETTER K): k
- U+0065 (LATIN SMALL LETTER E): e
- U+006C (LATIN SMALL LETTER L): l
- U+0079 (LATIN SMALL LETTER Y): y
- U+003A (COLON): :
- U+0020 (SPACE):  
- U+0036 (DIGIT SIX): 6
- U+0037 (DIGIT SEVEN): 7
- U+0020 (SPACE):  
- U+1F389 (PARTY POPPER): 🎉
In [2]:
def filename_for_codepoint(point):
    start = point // 256 * 256
    end = start + 255
    return f"{start}-{end}.pbf"
    
filename_for_codepoint(127881)
'127744-127999.pbf'