Skip to main content

RTFDE: RTF De-Encapsulator

A python3 library for extracting encapsulated HTML & plain text content from the RTF bodies of .msg files.

De-encapsulation enables previously encapsulated HTML and plain text content to be extracted and rendered as HTML and plain text instead of the encapsulating RTF content. After de-encapsulation, the HTML and plain text should differ only minimally from the original HTML or plain text content.

Features

  • De-encapsulate HTML from RTF encapsulated HTML.
  • De-encapsulate plain text from RTF encapsulated text.

Known Issues

  • This library fully unquotes text it de-encapsulates because it does not know which text was quoted in the RTF conversion process and which text was quoted in the original html/text. So, for instance escaped Quoted-Printable text will be returned un-escaped.
  • This library currently can't combine attachments from a .MSG Message object with the de-encapsulated HTML. This is mostly because I could not get a good set of examples of encapsulated HTML which had attachment objects that needed to be integrated back into the body of the HTML.

Anti-Features (I don't intend to have this library do this.)

  • Extract plain text from RTF encapsulated HTML. If you want this, then you will have to parse the HTML using another library.

Installation

To install from the pip package.

pip3 install RTFDE

Usage

De-encapsulating HTML or TEXT

from RTFDE.deencapsulate import DeEncapsulator

with open('rtf_file', 'r') as fp:
    raw_rtf  = fp.read()
    rtf_obj = DeEncapsulator(raw_rtf)
    rtf_obj.deencapsulate()
    if rtf_obj.content_type == 'html':
        print(rtf_obj.html)
    else:
        print(rtf_obj.text)

Contribute

Please check the contributing guidelines

License

Please see the license file for license information on RTFDE. If you have further questions related to licensing PLEASE create an issue about it on github.

Metadata

Release files for RTFDE 0.0.1

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

Source distribution (sdist)

Source distribution for RTFDE 0.0.1
File Size Uploaded Provenance Actions
RTFDE-0.0.1.tar.gz 18.9 kB Without provenance Details for RTFDE-0.0.1.tar.gz

Built distribution (wheel)

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

Total release size: 53.5 kB

Release files / RTFDE-0.0.1.tar.gz

Download URL RTFDE-0.0.1.tar.gz
Size 18.9 kB
Tags Source
SHA-256 checksum
How to use checksums
0e298ddfe17104f37f860cba071acd44ddb83db774c9f2788ad44882f0d32b06
BLAKE2b-256 checksum
How to use checksums
baaf125ed9337085bee6ce106e23766762bf18ac12875479e0d7f3dcdff6f3cf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.8.0 tqdm/4.54.1 CPython/3.9.1

Release files / RTFDE-0.0.1-py3-none-any.whl

Download URL RTFDE-0.0.1-py3-none-any.whl
Size 34.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a8962c651f17c7b9a994fccc6951429921abc0a82a736f58bb5f2a34a6ad561a
BLAKE2b-256 checksum
How to use checksums
ef02d379b3776d9823bbdf17fd3dc4f7424794925cff046f3d358ea475f27453
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.8.0 tqdm/4.54.1 CPython/3.9.1

Security for RTFDE 0.0.1

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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