Not knowing too much about QP encoding, is it just a matter of looking for
'=..' triplets?
yes. "=" chars are encoded as =.., all =.. are the hex code. The resulting
charset is that specified in the header, I expect (never had anthing
byt 8859-1 though). Here is a simple C fragment I use:
int hex_int_2_to_int (int a, int b)
{
a = (a >= '0' && a <= '9') ? a - '0' : a - 'A' + 10;
b = (b >= '0' && b <= '9') ? b - '0' : b - 'A' + 10;
return (a << 4) + b;
}
int maim_to_text (int thischar)
{
int r = 0;
static int lastchar = -1, watch = 0;
if (watch) {
if (lastchar >= 0) {
r = putc (hex_int_2_to_int (lastchar, thischar), out_file);
lastchar = -1; watch = 0;
} else
if (thischar == '\n')
watch = 0;
else
lastchar = thischar;
} else
if (! (watch = (thischar == '=')))
r = putc (thischar, out_file);
return r;
} /* maim_to_text() */
The function can only be called on 1 file max (missing initialisation
otherwise).
Volker