简体   繁体   English

URLDecoder:转义(%)模式中的非法十六进制字符-对于输入字符串:“ ^ *”

[英]URLDecoder: Illegal hex characters in escape (%) pattern - For input string: “^*”

i want to send an email this text 我想通过电子邮件发送此文本

Destination : 6W - ATLANTA WEST!@#$%^*!gemini!@#$%^*!jfds!@#$%^*!,Trailer Number : 000564,,Drop empty trailer at Plant Numbe :546,Pick up trailer at Plant Number :45, Bill Date : 25-Jan-2013,Bill Time - Eastern Time : 1,Trip Number :456,MBOL :546,Carrier :Covenant!@#$%^*!test@shaw.com!@#$%^*!transport@shaw.com!@#$%^*!test@transport.com!@#$%^*!antoalphi@gmail.com,Destination : 6W - ATLANTA WEST!@#$%^*!gemini!@#$%^*!jfds!@#$%^*!,Customer Name : 567,Cusomer Delivery Address : 657567657,General Comments :657,Warehouse Comments : 65,Carrier Comments : ,Appointment Date :25-Jan-2013,Appointment Time : 1am,Rail Only :Standard,Total Weight : 45645

and i used this mailContent = URLDecoder.decode(Body, "UTF-8"); 我用了这个mailContent = URLDecoder.decode(Body, "UTF-8"); decode, 解码,

but it is giving me this exception URLDecoder: Illegal hex characters in escape (%) pattern - For input string: "^*" 但它给了我这个异常URLDecoder: Illegal hex characters in escape (%) pattern - For input string: "^*"

could any one of you help me,how to solve this. 你们中的任何一个可以帮助我,如何解决这个问题。 I get this while sending mail. 发送邮件时收到此消息。

Best Regards 最好的祝福

You are trying to URL decode something that wasn't URL encoded in the first place. 您正在尝试对最初不是URL编码的内容进行URL解码。 What's wrong with the body as it is? 身体到底有什么问题? In other words, what happens if you just use: 换句话说,如果您仅使用以下内容会发生什么:

mailContent = Body

(In URL encoding, the % character is used with two hexadecimal digits to encode characters that might cause problems, for example / would be encoded as %2F , as its ASCII code is 47 (decimal) or 2F (hex). In your body, % is followed by two characters that are not hexadecimal digits - that's how I can tell it hasn't been URL encoded, and why the decoder is erroring.) (在URL编码中,%字符与两个十六进制数字一起使用,以编码可能引起问题的字符,例如/会被编码为%2F ,因为其ASCII码为47(十进制)或2F(十六进制)。在您的体内, %后跟两个不是十六进制数字的字符-这就是我可以知道它尚未经过URL编码的原因,以及解码器出错的原因。)

Simply stop calling URLDecoder.decode() and you will stop getting the error! 只需停止调用URLDecoder.decode(),您将停止获取错误! The string value you are passing to it is not URL encoded. 您传递给它的字符串值未经URL编码。

There are various forms of MIME encoding that you might want to consider, if you are sending an email with content that would not normally be allowed in an email message without encoding. 如果要发送的电子邮件中包含未经编码通常不允许在电子邮件中包含的内容,则可能需要考虑多种形式的MIME编码。 There references might be handy: 那里的参考可能很方便:

  1. What is allowed in SMTP: http://www.apps.ietf.org/rfc/rfc788.html SMTP中允许的内容: http//www.apps.ietf.org/rfc/rfc788.html
  2. Basic MIME encoding: http://www.apps.ietf.org/rfc/rfc1341.html 基本MIME编码: http//www.apps.ietf.org/rfc/rfc1341.html
  3. Java MIME support: http://docs.oracle.com/javaee/1.4/api/javax/mail/internet/MimeUtility.html Java MIME支持: http : //docs.oracle.com/javaee/1.4/api/javax/mail/internet/MimeUtility.html

For example, you might try: 例如,您可以尝试:

String sendable = MimeUtility.encodeText(body,"UTF-8","BASE64")

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 URLDecoder:转义(%)模式中的非法十六进制字符 - 对于输入字符串:“。P” - URLDecoder: Illegal hex characters in escape (%) pattern - For input string: “.P” URLDecoder:转义(%)模式中的非法十六进制字符 - 对于输入字符串:“</” - URLDecoder: Illegal hex characters in escape (%) pattern - For input string: “</” JMeter:java.lang.IllegalArgumentException:URLDecoder:转义(%)模式中的非法十六进制字符-对于输入字符串:“Õ” - JMeter: java.lang.IllegalArgumentException: URLDecoder: Illegal hex characters in escape (%) pattern - For input string: “Õ­” URLDecoder:多部分数据的转义(%)模式中的非法十六进制字符 - URLDecoder: Illegal hex characters in escape (%) pattern for multipart data URLDecoder:使用spring上传时,不完整的尾随转义(%)模式 - URLDecoder: Incomplete trailing escape (%) pattern when upload using spring 字符串非法转义字符 - String illegal escape charcter 具有输入字符模式的排序字符串 - Sorted String with input characters pattern JSON的非法字符/转义字符 - Illegal Characters/Escape-Necessary characters for JSON 替换字符串中的非法字符 - Replacing Illegal Characters in a String 带有转义字符的 Java 模式正则表达式 - Java pattern regex with escape characters
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM