Encoder for unicode to RTF 1.5 command sequences
Project description
Unicode to RTF command code conversion
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
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rtfunicode-2.3.tar.gz.
File metadata
- Download URL: rtfunicode-2.3.tar.gz
- Upload date:
- Size: 4.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
800d1ef6dcc01505a5912958e7267332ccb1a58e0c6faf213af5f9cd85fa321a
|
|
| MD5 |
639f14b36e9b0b093065791ab14747c7
|
|
| BLAKE2b-256 |
92265e41e1d4f579137b35729b2f764f405989181fd53bb14645ac00fb23630b
|
Provenance
The following attestation bundles were made for rtfunicode-2.3.tar.gz:
Publisher:
ci-cd.yml on mjpieters/rtfunicode
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rtfunicode-2.3.tar.gz -
Subject digest:
800d1ef6dcc01505a5912958e7267332ccb1a58e0c6faf213af5f9cd85fa321a - Sigstore transparency entry: 833312061
- Sigstore integration time:
-
Permalink:
mjpieters/rtfunicode@264334b9f6b20d81c4a132371f877a26ed04f2e0 -
Branch / Tag:
refs/tags/v2.3 - Owner: https://github.com/mjpieters
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci-cd.yml@264334b9f6b20d81c4a132371f877a26ed04f2e0 -
Trigger Event:
push
-
Statement type:
File details
Details for the file rtfunicode-2.3-py3-none-any.whl.
File metadata
- Download URL: rtfunicode-2.3-py3-none-any.whl
- Upload date:
- Size: 4.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
60c2948fed7bd46a07cd9227c5f4cb2580d819b3bc56272734b9fcbc1a6cb594
|
|
| MD5 |
2f0bb1623568b64a0a0f23fdfac6ba85
|
|
| BLAKE2b-256 |
086c371cae9cee339dc234f9f1ad082e40cb083f744e790bd9408357dfd9ecdd
|
Provenance
The following attestation bundles were made for rtfunicode-2.3-py3-none-any.whl:
Publisher:
ci-cd.yml on mjpieters/rtfunicode
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rtfunicode-2.3-py3-none-any.whl -
Subject digest:
60c2948fed7bd46a07cd9227c5f4cb2580d819b3bc56272734b9fcbc1a6cb594 - Sigstore transparency entry: 833312064
- Sigstore integration time:
-
Permalink:
mjpieters/rtfunicode@264334b9f6b20d81c4a132371f877a26ed04f2e0 -
Branch / Tag:
refs/tags/v2.3 - Owner: https://github.com/mjpieters
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci-cd.yml@264334b9f6b20d81c4a132371f877a26ed04f2e0 -
Trigger Event:
push
-
Statement type: