Skip to main content

Unicode to RTF command code conversion

PyPI version License Python versions supported Built with uv Checked with Ruff Checked with Pyright Python checks Coverage

This module implements an encoder for unicode to RTF 1.5 command sequences; it can be used to generate valid RTF output with international characters.

Importing this module adds a new rtfunicode codec, allowing you to encode unicode strings to valid RTF bytecode sequences:

>>> import rtfunicode
>>> 'RTF and unicode mix just fine! \u263A'.encode('rtfunicode')
'RTF and unicode mix just fine! \\u9786?'

The RTF command code for a unicode character is \uN?, where N is a signed 16-bit integer and the ? is a placeholder character for older RTF readers. This module sets the latter to the '?' literal for simplicity's sake.

Requirements

  • Python 3.10 or newer.

Development

The project code is hosted on GitHub, feel free to report issues, fork the code and issue pull requests.

This project uses uv to handle Python dependencies and environments; use uv sync to get an up-to-date virtualenv with all dependencies. This includes development dependencies such as Ruff (used for linting and formatting) and Pyright (used to validate type annotations).

Linting and formatting

While PRs and commits on GitHub are checked for linting and formatting issues, it's easier to check for issues locally first. After running uv sync, run uv run pre-commit install to install pre-commit hooks that will run these tools and format your changes automatically on commits. These hooks also run uv sync whenever your working tree changes.

Testing

This project uses pytest to run its tests: uv run pytest.

License

BSD 2-Clause (simplified), see: LICENSE.txt

Author

Martijn Pieters mj@zopatista.com

Metadata

Release files for rtfunicode 2.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rtfunicode 2.3
File Size Uploaded
rtfunicode-2.3.tar.gz 4.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for rtfunicode 2.3
File Interpreter ABI Platform
rtfunicode-2.3-py3-none-any.whl Python 3 none any Details

Total release size: 9.4 kB

Release files / rtfunicode-2.3.tar.gz

Download URL rtfunicode-2.3.tar.gz
Size 4.5 kB
Tags Source
SHA-256 checksum
How to use checksums
800d1ef6dcc01505a5912958e7267332ccb1a58e0c6faf213af5f9cd85fa321a
BLAKE2b-256 checksum
How to use checksums
92265e41e1d4f579137b35729b2f764f405989181fd53bb14645ac00fb23630b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 17, 2026.

Transparency log

Release files / rtfunicode-2.3-py3-none-any.whl

Download URL rtfunicode-2.3-py3-none-any.whl
Size 4.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
60c2948fed7bd46a07cd9227c5f4cb2580d819b3bc56272734b9fcbc1a6cb594
BLAKE2b-256 checksum
How to use checksums
086c371cae9cee339dc234f9f1ad082e40cb083f744e790bd9408357dfd9ecdd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 17, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

2.3 This release

2 release files

2.2

2 release files

2.1

2 release files

2.0

2 release files

1.4

2 release files

1.3

2 release files

1.2

2 release files

1.1

2 release files

1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page