7

How do I decode quoted-printable using Java. I am reading mail from the server and fetching some data from mail using regex. My mail content type is text/html and because of this, I am getting HTML tags along with the data, making it very difficult for me to do the pattern matching. It is showing some characters like =20, =cF, etc.

How can I resolve this problem?

Will Eddins
  • 13,628
  • 5
  • 51
  • 85
shikha
  • 79
  • 1
  • 3
  • 5
    [MimeUtility](http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/mail/internet/MimeUtility.html) supports quoted-printable. See the [decode()](http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/mail/internet/MimeUtility.html#decode%28java.io.InputStream,%20java.lang.String%29) method. – danben May 17 '10 at 16:50
  • i have done the same thing.. but it is not decoding... MimeUtility.decode("String","UTF-8"); Tell me one thing what should i write to decode "quoted-printable" in encoding string???? – shikha May 18 '10 at 05:37
  • 3
    First of all, the first parameter to `decode` is an `InputStream`, so your example should not compile. Second, the second parameter should be `"quoted-printable"`, as it says right in the documentation I linked to. – danben May 18 '10 at 13:01
  • @danben You should post that as a proper answer as it solves the problem perfectly! – thomas.mc.work Nov 02 '17 at 07:30

0 Answers0