0

我无法解码附件。它类似于=?utf-8?B?MS5qcGc=被编码的东西。我需要解码那个附件。我用来解码的java代码

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;
 }

请帮我解码。

4

1 回答 1

1

您正在尝试解码附件名称,对吗?请参阅此 JavaMail FAQ 条目

于 2012-05-14T17:26:06.667 回答