如何解决路径此异常非法字符? [英] how to solve this exception Illegal character in path?

查看:306
本文介绍了如何解决路径此异常非法字符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是从网址使用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: http://www.theblacksheeponline.com/party_img/thumbspps/12390867930_15951_186997180114_709920114_4296270_6115611_n[1].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

这篇关于如何解决路径此异常非法字符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆