[fpc-pascal] processing quote-printable text...

waldo kitty wkitty42 at windstream.net
Thu Feb 10 21:24:45 CET 2011


i am processing an email message that is saved to a text file... currently my 
processing only locates the content type, plain/text or multipart... if 
multipart, then we look for the plain/text section and the multipart boundary... 
all we want is the plain/text...

i've been doing this with a TP/BP program but have recently run into a problem 
with line lengths longer than 255 characters... so i'm porting the tool to be a 
native OS/2 FPC tool... the only real change i had to make was to change 
"string" to "ansistring"...

now i'm wanting to clean up the rest of the processing... previously we were 
using the above mentioned tool to extract and save the plain text content... in 
some cases, this is peppered with things like "=20" for spaces, "=99" for "(tm)" 
and such... and yes, in some cases lines are broken at a set length with "=" at 
their end... i want to clean all of this up in the above tool so that i can get 
rid of the external sed processing...

the sed processing works and works well but now i'm (back) to having clean lines 
longer than 255 characters... another tool takes this output file and posts it 
to various message bases but the other tool cannot be so easily ported to handle 
line lengths longer than 255 characters... so one of the things the initial 
conversion tool also needs to do, after everything else, is to word-wrap at 
column 70 or the first previous space if column 70's character is not a space...

what would you recommend for handling this process so that the tool i'm 
converting outputs a clean plain ascii text file with no lines longer than 70 
characters? is there a mime(?) conversion library available in FPC to handle 
that part so i don't have to code specific replacements as i do with the sed 
process now? is there a line length routine that will break long lines into 
individual lines of X length?

in my BP/TP world, i had things like word-wrap taken care of with other 
libraries but i cannot port them to FPC (yet)... my main goal is to get this one 
tool working first and then move on to other tasks...

thanks!




More information about the fpc-pascal mailing list