Roshan
Roshan

Reputation: 2059

How to decode UTF-8 encoded String using java?

Actually i'm having String in UTF-8 encoded form in the mail. I want it to decode it. I use Java mimeutility.decode text. But it doesn't decode properly. Example String

=?UTF-8?B?0J/RgNC40LLQtdGC?==?UTF-8?B?0JfQtNGA0LDQstGB0YLQstGD0LnRgtC1?=

When i used

MimeUtility.decodeText("=?UTF-8?B?0J/RgNC40LLQtdGC?==?UTF-8?B?0JfQtNGA0LDQstGB0YLQstGD0LnRgtC1?=")

it yields

Привет=?UTF-8?B?0JfQtNGA0LDQstGB0YLQstGD0LnRgtC1?=

Please help me. Thanks in advance

Upvotes: 0

Views: 4510

Answers (1)

J-16 SDiZ
J-16 SDiZ

Reputation: 26930

It is mime-encoded -- the "B" encoding, to be specific (rfc2047 section 4.1).

I think you can decode it using javamail javax.mail.internet.InternetHeaders or MimeUtility class.

Upvotes: 5

Related Questions