skillfed

rtfunicode

Encoder for unicode to RTF 1.5 command sequences

rtfunicode v2.3 134.0K downloads/30d#11,490 on PyPI19
Permissive license BSD-2-Clause Active released

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 rtfunicode

uv

uv add rtfunicode

poetry

poetry add rtfunicode

Installing 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

Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: BSD LicenseProgramming Language :: Python :: 3

Tags

unicode to rtf encodingrtf codec pythoninternational characters rtfunicode rtf conversionrtf command sequencesrtf bytecode encoder
rtf-exportunicode-codectext-encoding

More Markup packages