public String base64(String content){ //对字符串进行Base64编码 try { content = Base64.encodeToString(content.getBytes("utf-8"),Base64.DEFAULT); content = URLEncoder.encode(content); //对字符串进行URL编码 } catch (UnsupportedEncodingException e) { e.printStackTrace(); //输出异常信息 } return content; }