rtfunicode
Encoder for unicode to RTF 1.5 command sequences
What it is and what it does
rtfunicode is a codec module that bridges Unicode and RTF by converting Unicode strings into valid RTF 1.5 command sequences. When imported, it registers a new codec that allows you to call `.encode('rtfunicode')` on any Unicode string, transforming international characters into RTF escape codes of the form `\uN?`, where N is a signed 16-bit integer and ? is a placeholder character for older RTF readers.
The package is lightweight with no external dependencies and is designed for developers who need to generate RTF documents containing non-ASCII characters. It has been maintained since 2012 and currently requires Python 3.10 or newer. The implementation is straightforward: it converts each Unicode character to its RTF command equivalent, making it useful for applications that export text data to RTF format while preserving international characters.
Use it for:
- Export Unicode text to RTF documents with proper international character encoding for word processors.
- Generate RTF reports or templates containing non-ASCII characters from Python applications.
- Convert user-supplied Unicode strings to RTF-compatible bytecode in document generation pipelines.
- Ensure backward compatibility with older RTF readers by encoding Unicode as RTF escape sequences.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Encodes Unicode strings to RTF 1.5 command sequences, registering a codec that converts Unicode characters into valid RTF bytecode for international character support.
Yes. The package is lightweight, actively maintained, has no dependencies, and solves a specific problem with a clean API. It carries permissive licensing and no known vulnerabilities. Install it if you need to generate RTF output with international characters; skip it if you don't work with RTF.
Install
rtfunicode on PyPI
pip
pip install rtfunicodeuv
uv add rtfunicodepoetry
poetry add rtfunicodeInstalling rtfunicode
Before you install
Low install friction with no runtime dependencies. Actively maintained with recent commits and a stable release history since 2012; last release was 2026-01-17.
License in practice
BSD-2-Clause is permissive, allowing commercial and private use with minimal restrictions; attribution and license text preservation are required.
Quickstart
import rtfunicode
'RTF and unicode mix just fine! \u263A'.encode('rtfunicode')
Requires Python 3.10 or newer.
Verify before relying
- Whether the codec handles all Unicode planes or only the Basic Multilingual Plane (BMP) via 16-bit signed integers.
- Performance characteristics when encoding large documents or streams with many non-ASCII characters.
Package facts
| License | BSD-2-Clause (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 209 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 133,990/month — #11,490 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: rtfunicode-2.3-py3-none-any.whl
Keywords: rtf
Tags
More Markup packages
PyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
markdown-it-pyA Python markdown parser that converts markdown…
permissive · top 100 on PyPI
beautifulsoup4Beautiful Soup parses HTML and XML documents…
permissive · top 100 on PyPI
et-xmlfileet_xmlfile writes large XML files with minimal…
permissive · top 1,000 on PyPI
tomlkitParses and edits TOML files while preserving…
permissive · top 1,000 on PyPI
docstring-parserParses Python docstrings in ReST, Google,…
permissive · top 1,000 on PyPI
mbstrdecoderDecodes multi-byte character strings by…
permissive · top 5,000 on PyPI
UnidecodeConverts Unicode text to ASCII-safe…
copyleft · top 1,000 on PyPI
mutf8Encodes and decodes MUTF-8 (Modified UTF-8), a…
permissive · top 5,000 on PyPI
ebcdicRegisters additional EBCDIC character encoding…
permissive · top 5,000 on PyPI
base2048Encodes and decodes binary data using Base2048,…
permissive · top 15,000 on PyPI
latexcodecProvides a Python codec to convert between…
permissive · top 5,000 on PyPI
ecojiEncodes and decodes binary data as sequences of…
permissive · top 15,000 on PyPI
anyasciiConverts Unicode text to ASCII-only equivalents…
permissive · top 5,000 on PyPI
fold-to-asciiConverts Unicode characters outside the basic…
permissive · top 15,000 on PyPI
cwcwidthcwcwidth provides fast Python bindings for…
permissive · top 15,000 on PyPI