如何解决路径此异常非法字符?如何解决、路径、字符、异常

2023-09-05 08:30:32 作者:姐有迩妈没有的范er

我是从网址使用XML分析显示图像,但图像显示得非常好,有一段时间我有例外,比如

i am displaying images from url using xml parsing,some images are displaying very well,some time i got exception like

Illegal character in path at index 113: https://m.xsw88.com/allimgs/daicuo/20230905/1834.png.jpg

我该如何解决这个问题,有人知道,请给一些样品code,我...

How can i solve this problem,anybody know,please give some sample code for me...

感谢所有

推荐答案

特殊字符需要转义,如%5B 的[和%5D 的]

Special characters need escaping such as %5B for [ and %5D for ]

您可以使用 java.net.URLEn codeR 来恩code中的URL作为

You can use the java.net.URLEncoder to encode the URL as in

java.net.URLEncoder

URLEn coder.en code(myurltoen code,UTF-8);

URLEncoder.encode(myurltoencode,"UTF-8");

这将不只是修复[或],但也有其他的编码问题

This will not just fix the [ or ] but also other encoding issues