`
hugh.wangp
  • 浏览: 288968 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
社区版块
存档分类
最新评论

[解决方案]java.net.URISyntaxException: Illegal character in query at index

    博客分类:
  • JAVA
阅读更多

 

导致这种错误的原因是因为URL没有进行编码,URL不识别你提供的URL字符串
String test = "{hello world!}";
String testEncode = URLEncoder. encode(test, "utf-8" );
String testDecode = URLDecoder.decode(testEncode, "utf-8");
System. out .println(test);
System. out .println(testEncode);
System. out .println(testDecode);
 返回结果:
{hello world!}
%7Bhello+world%21%7D
{hello world!}
 

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics