Skip to main content

Pure Python Unicode character toolkit — 17 encoding formats, full Unicode properties, 90 HTML entities, character search.

Project description

unicodefyi

PyPI Python License: MIT

Pure Python Unicode character toolkit. Compute 17 encoding representations and full Unicode properties for any character. Includes character search across 20 Unicode ranges, 90 HTML entity mappings, and 48 script-to-slug conversions.

Look up any character at unicodefyi.com

Install

pip install unicodefyi              # Core (zero deps)
pip install "unicodefyi[full]"      # + fonttools for Unicode block/script

Quick Start

from unicodefyi import get_encodings, get_char_info, search

# Encode any character (17 formats)
enc = get_encodings("✓")
print(enc.unicode)        # U+2713
print(enc.html_entity)    # ✓
print(enc.css)            # \2713
print(enc.go)             # \u2713
print(enc.rust)           # \u{2713}
print(enc.utf8_bytes)     # e2 9c 93
print(enc.utf32be_bytes)  # 00 00 27 13

# Full Unicode properties (requires fonttools for block/script)
info = get_char_info(0x2713)
print(info.name)          # CHECK MARK
print(info.category_name) # Other Symbol
print(info.block)         # Dingbats
print(info.script_slug)   # common

# Search characters by name
results = search("arrow")
for r in results[:5]:
    print(f"U+{r.codepoint:04X} {r.character} {r.name}")

API Reference

Core Functions

Function Description
get_encodings(char) -> EncodingInfo 17 encoding representations
get_char_info(codepoint) -> CharInfo | None Full Unicode properties + encodings
search(query, limit=50) -> list[CharInfo] Search by character name
get_category_name(code) -> str Category code to human name
lookup_html_entity(entity) -> str | None Entity string to character

Data Types

  • EncodingInfo — 17-field NamedTuple: unicode, decimal, html_decimal, html_hex, html_entity, css, javascript, python, java, go, ruby, rust, c_cpp, url_encoded, utf8_bytes, utf16be_bytes, utf32be_bytes
  • CharInfo — 14-field NamedTuple: codepoint, character, name, category, category_name, block, block_slug, script, script_slug, bidirectional, combining, mirrored, decomposition, encodings

Constants

Constant Count Description
GENERAL_CATEGORY_NAMES 30 Full UAX #44 category names
SCRIPT_CODE_TO_SLUG 48 ISO 15924 script codes to SEO-friendly slugs
HTML_ENTITIES 90 Codepoint-to-entity mappings
HTML_ENTITY_TO_CHAR 90 Entity-to-character reverse mappings

17 Encoding Formats

Format Example () Language
Unicode U+2713 Standard
Decimal 10003
HTML decimal ✓ HTML
HTML hex ✓ HTML
HTML entity ✓ HTML
CSS \2713 CSS
JavaScript \u2713 JS
Python \u2713 Python
Java \u2713 Java
Go \u2713 Go
Ruby \u{2713} Ruby
Rust \u{2713} Rust
C/C++ \u2713 C/C++
URL-encoded %E2%9C%93 URL
UTF-8 bytes e2 9c 93 Binary
UTF-16 BE 27 13 Binary
UTF-32 BE 00 00 27 13 Binary

Features

  • 17 encoding types: The most comprehensive encoding toolkit — covers 10+ programming languages
  • Unicode properties: name, category, block, script, bidirectional, combining, mirrored, decomposition
  • Character search: Scan 20 Unicode ranges (Latin, Greek, Cyrillic, CJK, symbols, etc.)
  • 90 HTML entities: Common entities with bidirectional lookup
  • 48 script mappings: ISO 15924 script codes to SEO-friendly slugs
  • 30 general categories: Full UAX #44 category names
  • Zero required deps: Core uses only stdlib (unicodedata, urllib.parse)
  • Optional fonttools: Install unicodefyi[full] for block and script info
  • Type-safe: Full type annotations, py.typed marker (PEP 561)

Related Packages

Package Description
symbolfyi Lighter symbol toolkit with 11 encodings
colorfyi Color conversion, contrast, harmonies, shades
emojifyi Emoji encoding & metadata for 3,781 emojis
fontfyi Google Fonts metadata, CSS helpers, font pairings

Links

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

unicodefyi-0.1.0.tar.gz (35.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

unicodefyi-0.1.0-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

Details for the file unicodefyi-0.1.0.tar.gz.

File metadata

  • Download URL: unicodefyi-0.1.0.tar.gz
  • Upload date:
  • Size: 35.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.8 {"installer":{"name":"uv","version":"0.10.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for unicodefyi-0.1.0.tar.gz
Algorithm Hash digest
SHA256 84dfc18805f3190b089c751a9a0c341fc1715d2e0b72a46f1fcd212093e86702
MD5 7d8e73ac1cda27b64867a789c099e173
BLAKE2b-256 e09ad5b7a80b77f61ff957bb4744af47d820fc324e52a57866aaf4d2eae3fdc1

See more details on using hashes here.

File details

Details for the file unicodefyi-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: unicodefyi-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.8 {"installer":{"name":"uv","version":"0.10.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for unicodefyi-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 60972dc0841c008fc096e6e2411b04fb61fe455872e2cb2d3794b2d887e636a1
MD5 383bd9bb229aa0017446158738d194e0
BLAKE2b-256 f9ac5e3e7091fb91431466f0ecb975b70a1d20e8c487b474ec549b1019393cb6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page