Skip to content

Encoder for unicode to RTF 1.5 command sequences

License

Notifications You must be signed in to change notification settings

PyPublishing/rtfunicode

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 simlicity's sake.

Requirements

  • Python 3.3-3.8

Development

https://travis-ci.org/mjpieters/rtfunicode.svg?branch=master

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

License

BSD (simplified), see: LICENSE.txt

Author

Martijn Pieters <[email protected]>

About

Encoder for unicode to RTF 1.5 command sequences

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%