{"library":"rtfunicode","title":"rtfunicode","description":"rtfunicode is a Python library (version 2.3) that provides an encoder for Unicode to RTF 1.5 command sequences. It allows for generating valid RTF output that includes international characters by registering a new `rtfunicode` codec, which can then be used directly with `str.encode()`. The library is actively maintained, with a focus on modern Python versions.","language":"python","status":"active","last_verified":"Thu Apr 16","install":{"commands":["pip install rtfunicode"],"cli":null},"imports":["import rtfunicode"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import rtfunicode\n\n# Encode a Unicode string to RTF using the 'rtfunicode' codec\nunicode_string = 'Hello, RTF and unicode mix just fine! \\u263A'\nrtf_output = unicode_string.encode('rtfunicode')\n\nprint(f\"Original Unicode: {unicode_string}\")\nprint(f\"Encoded RTF: {rtf_output!r}\")\n\n# The output includes the \\uN? sequence for Unicode characters\n# For example, \\u263A (smiling face) becomes \\u9786? (N=9786 in signed 16-bit int)\nassert rtf_output == b'Hello, RTF and unicode mix just fine! \\\\u9786?'","lang":"python","description":"This quickstart demonstrates how to import `rtfunicode` to register its codec, and then use the `encode('rtfunicode')` method on a standard Python string to convert Unicode characters into their RTF 1.5 command sequences.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}