Skip to main content

Pure Python symbol encoder -- 11 encoding formats, Unicode properties, HTML entities, CLI, MCP server, and API client.

Project description

symbolfyi

PyPI Python License: MIT

Pure Python symbol encoder for developers. Compute 11 encoding representations and full Unicode properties for any character. Includes 51 HTML entity mappings, a CLI, MCP server for AI assistants, and an API client for symbolfyi.com.

Look up any symbol at symbolfyi.com -- symbol encoder, HTML entity collections, Unicode blocks

symbolfyi CLI demo

Table of Contents

Install

pip install symbolfyi              # Core (zero dependencies)
pip install "symbolfyi[full]"      # + fonttools for Unicode block/script
pip install "symbolfyi[cli]"       # + CLI (typer, rich)
pip install "symbolfyi[mcp]"       # + MCP server for AI assistants
pip install "symbolfyi[api]"       # + HTTP client for symbolfyi.com API
pip install "symbolfyi[all]"       # Everything

Quick Start

from symbolfyi import get_encodings, get_info, lookup_html_entity

# Encode any character (11 formats)
enc = get_encodings("->")
print(enc.unicode)        # U+2192
print(enc.html_entity)    # →
print(enc.css)            # \2192
print(enc.javascript)     # \u{2192}
print(enc.utf8_bytes)     # e2 86 92
print(enc.url_encoded)    # %E2%86%92

# Full Unicode properties (requires fonttools for block/script)
info = get_info("*")
print(info.name)          # BLACK SPADE SUIT
print(info.category_name) # Other Symbol
print(info.block)         # Miscellaneous Symbols
print(info.script)        # Common

# HTML entity reverse lookup
char = lookup_html_entity("♥")
print(char)               # (heart character)

What You Can Do

Symbol Encoding

When working with special characters in web development, you often need the same symbol in different encoding formats -- an HTML entity for markup, a CSS escape for stylesheets, a JavaScript literal for scripts, or raw UTF-8 bytes for server-side processing. The get_encodings() function computes all 11 representations from a single character input, covering every major platform and language.

Format Example (U+2192 RIGHTWARDS ARROW) Use Case
Unicode U+2192 Documentation, Unicode charts
HTML Decimal → HTML numeric character references
HTML Hex → HTML hexadecimal references
HTML Entity → Named HTML entities (51 supported)
CSS \2192 CSS content property, pseudo-elements
JavaScript \u{2192} ES6+ string literals
Python \u2192 Python source code escapes
Java \u2192 Java string literals
UTF-8 Bytes e2 86 92 Network protocols, file encoding
UTF-16 Bytes 21 92 Windows APIs, Java internals
URL Encoded %E2%86%92 Query strings, URL paths
from symbolfyi import get_encodings

# Encode any symbol into all 11 representation formats
enc = get_encodings("\u00a9")  # Copyright sign
print(enc.unicode)        # U+00A9
print(enc.html_entity)    # ©
print(enc.html_decimal)   # ©
print(enc.css)            # \00A9
print(enc.javascript)     # \u{A9}
print(enc.python)         # \u00a9
print(enc.utf8_bytes)     # c2 a9
print(enc.url_encoded)    # %C2%A9

Learn more: Symbol Encoding Tools · HTML Entity Collections

Unicode Properties

Every character in the Unicode Standard carries a set of properties that describe its behavior and classification. The Unicode General Category (e.g., "Lu" for uppercase letter, "Sm" for math symbol) determines how text processors handle the character. The block identifies which range of the Unicode codespace the character belongs to (e.g., "Arrows", "Mathematical Operators"), while the script property indicates the writing system (e.g., "Latin", "Common"). Bidirectional properties control text layout in mixed left-to-right and right-to-left content.

Property Description Example (U+2665 BLACK HEART SUIT)
Name Official Unicode character name BLACK HEART SUIT
Category General category code + name So (Other Symbol)
Block Unicode block range Miscellaneous Symbols
Script Writing system Common
Bidirectional Text direction class ON (Other Neutral)
Combining Combining class value 0 (Not Reordered)
Mirrored Whether glyph mirrors in RTL N
Decomposition Canonical decomposition (empty for most symbols)
from symbolfyi import get_info

# Retrieve full Unicode properties for any character
info = get_info("\u2665")  # Black heart suit
print(info.name)           # BLACK HEART SUIT
print(info.category)       # So
print(info.category_name)  # Other Symbol
print(info.block)          # Miscellaneous Symbols
print(info.script)         # Common
print(info.bidirectional)  # ON

# Access the encodings alongside Unicode properties
print(info.encodings.html_entity)  # ♥
print(info.encodings.css)          # \2665

Learn more: Unicode Block Reference · Unicode Script Reference

CLI

Requires the cli extra: pip install symbolfyi[cli]

# Full symbol info (Unicode properties + all encodings)
symbolfyi info "->"

# Show all 11 encodings
symbolfyi encode "*"

# Reverse HTML entity lookup
symbolfyi entity "♥"
symbolfyi entity amp

MCP Server

Requires the mcp extra: pip install symbolfyi[mcp]

Add to your claude_desktop_config.json:

{
    "mcpServers": {
        "symbolfyi": {
            "command": "python",
            "args": ["-m", "symbolfyi.mcp_server"]
        }
    }
}

Available tools:

Tool Description
symbol_info Full Unicode properties + 11 encodings
symbol_encode Encode a character into 11 representations
html_entity_lookup Reverse HTML entity lookup

API Client

Requires the api extra: pip install symbolfyi[api]

from symbolfyi.api import SymbolFYI

with SymbolFYI() as api:
    # Encode a character
    info = api.encode("->")
    print(info["encodings"]["html_entity"])

    # Search symbols
    results = api.search("arrow")
    for r in results["results"]:
        print(r["character"], r["name"])

    # Browse Unicode blocks
    blocks = api.blocks()
    print(blocks["count"])

    # Get collection details
    arrows = api.collection("arrows")
    print(arrows["name"])

Full API documentation at symbolfyi.com/developers.

API Reference

Core Functions

Function Description
get_encodings(char) -> EncodingInfo Compute 11 encoding representations
get_info(char) -> SymbolInfo | None Full Unicode properties + encodings
get_category_name(code) -> str Category code to human name
lookup_html_entity(entity) -> str | None Entity string to character

Data Types

  • EncodingInfo -- 11-field NamedTuple: unicode, html_decimal, html_hex, html_entity, css, javascript, python, java, utf8_bytes, utf16_bytes, url_encoded
  • SymbolInfo -- 12-field NamedTuple: codepoint, character, name, category, category_name, block, script, bidirectional, combining, mirrored, decomposition, encodings

Constants

Constant Description
GENERAL_CATEGORIES 27 Unicode category codes with names
HTML_ENTITIES 51 codepoint-to-entity mappings
HTML_ENTITY_TO_CHAR 51 entity-to-character reverse mappings

Features

  • 11 encoding types: Unicode, HTML decimal/hex/entity, CSS, JavaScript, Python, Java, UTF-8/UTF-16 bytes, URL-encoded
  • Unicode properties: name, category, block, script, bidirectional, combining, mirrored, decomposition
  • 51 HTML entities: Common entities with bidirectional lookup
  • Zero required deps: Core uses only stdlib (unicodedata, urllib.parse)
  • Optional fonttools: Install symbolfyi[full] for Unicode block and script info
  • CLI: Rich terminal interface for symbol info, encoding, and entity lookup
  • MCP server: AI assistant integration with 3 tools
  • API client: HTTP client for symbolfyi.com REST API
  • Type-safe: Full type annotations, py.typed marker (PEP 561)

Learn More About Symbols

FYIPedia Developer Tools

Part of the FYIPedia open-source developer tools ecosystem.

Package PyPI npm Description
colorfyi PyPI npm Color conversion, WCAG contrast, harmonies -- colorfyi.com
emojifyi PyPI npm Emoji encoding & metadata for 3,781 emojis -- emojifyi.com
symbolfyi PyPI npm Symbol encoding in 11 formats -- symbolfyi.com
unicodefyi PyPI npm Unicode lookup with 17 encodings -- unicodefyi.com
fontfyi PyPI npm Google Fonts metadata & CSS -- fontfyi.com
distancefyi PyPI npm Haversine distance & travel times -- distancefyi.com
timefyi PyPI npm Timezone ops & business hours -- timefyi.com
namefyi PyPI npm Korean romanization & Five Elements -- namefyi.com
unitfyi PyPI npm Unit conversion, 220 units -- unitfyi.com
holidayfyi PyPI npm Holiday dates & Easter calculation -- holidayfyi.com
cocktailfyi PyPI -- Cocktail ABV, calories, flavor -- cocktailfyi.com
fyipedia PyPI -- Unified CLI: fyi color info FF6B35 -- fyipedia.com
fyipedia-mcp PyPI -- Unified MCP hub for AI assistants -- fyipedia.com

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

symbolfyi-0.2.1.tar.gz (452.3 kB view details)

Uploaded Source

Built Distribution

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

symbolfyi-0.2.1-py3-none-any.whl (14.0 kB view details)

Uploaded Python 3

File details

Details for the file symbolfyi-0.2.1.tar.gz.

File metadata

  • Download URL: symbolfyi-0.2.1.tar.gz
  • Upload date:
  • Size: 452.3 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 symbolfyi-0.2.1.tar.gz
Algorithm Hash digest
SHA256 95ab452594627acf166a27926ca41d8b754e26c8eacd39c9ea2bc66e1ca4bb94
MD5 df2b6d0a9670bcdf86f1779788ed450f
BLAKE2b-256 69f6cafd811dd908aec6b5cb979be15b56182e9611d9bd303614b09e7ee35d1f

See more details on using hashes here.

File details

Details for the file symbolfyi-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: symbolfyi-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 14.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 symbolfyi-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 987bd08a8705dd77e6cfabaf123f0ef0d2809e6f38749f6f177c585457638d01
MD5 8431abb07da90bb635990d658fede3cf
BLAKE2b-256 f0b1dd2d4d2997eefa943ed46f9a2e1534ac4938f653e50b7694249c7f6d9290

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