Reputation: 187
I am unable to decode the attachment. It something like =?utf-8?B?MS5qcGc=
which is encoded. I need to decode that attachment.
The java code i am using to decode
private static String decodeName(String name) throws Exception {
if (name == null || name.length() == 0) {
return "unknown";
}
String ret = java.net.URLDecoder.decode(name, "UTF-8");
// also check for a few other things in the string:
ret = ret.replaceAll("=\\?utf-8\\?q\\?", "");
ret = ret.replaceAll("\\?=", "");
ret = ret.replaceAll("=20", " ");
return ret;
}
Please help me out for decoding.
Upvotes: 0
Views: 2342
Reputation: 29971
You're trying to decode the attachment name, right? See this JavaMail FAQ entry.
Upvotes: 1