Tuesday, May 28, 2002 08:09 AM
You've got a string that is encoded in the standard for email headers, and you need to decode it.
I haven't used the JavaMail API myself but maybe "decodeText()" from "MimeUtility" would do what you need?
If you want to roll your own and do it yourself the good old-fashioned way, or just understand what is going on (the quoted-printable decoding):
The text encoding for email headers in the MIME RFC's is similar if not identical to MIME "quoted printable" content-transfer-encoding I think? with the addition of the charset prefix e.g. the "iso-8859-1" surrounded by question-mark quotes.
Quoted-printable content-transfer-encoding was the predecessor of, and similar to, but not identical to, the "URL encoding" of the HTML/HTTP RFC's.
For instance, "=20" is the quoted-printable encoding of the ASCII blank space character. The "=" is the escape prefix and the "20" is the ASCII value. The HTML/HTTP authors adapted this to "%20" instead, using "%" as the escape prefix.