Suggestions for converting raw RTF (rich text format) to plain text

mthelm85
Tue, 09 May 2023 17:58:40 +0000
General Usage

I am going to be pulling some data from an IBM DB2 database that is stored as CLOB data. It’s Rich Text Format (RTF) text data and what I want to do is convert it to plain text. Here’s an example of what it looks like:

 {\rtf1\ansi{\fonttbl\f0\fswiss Helvetica;}\f0\pard
 This is some {\b bold} text.\par
 }

What I want is to strip out all the RTF junk and end up with:

This is some bold text.

I took a quick look at the JuliaText family of packages and didn’t see anything that looked like it could strip out the RTF stuff and from what I’ve read, you can’t get all of the RTF stuff with RegEx.

It looks like my only option may be to call a library from another language, or to utilize a command line tool from Julia. Any thoughts/advice would be much appreciated!

12 posts - 5 participants

Read full topic