如何处理URISyntaxException [英] How to deal with the URISyntaxException

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

问题描述

我收到此错误消息:

java.net.URISyntaxException: Illegal character in query at index 31: http://finance.yahoo.com/q/h?s=^IXIC

My_Url = http://finance.yahoo.com/q/h?s=^IXIC

当我将其复制到浏览器地址时字段,它显示正确的页面,它是一个有效的 URL ,但我不能解析它:新URI(My_Url)

When I copied it into a browser address field, it showed the correct page, it's a valid URL, but I can't parse it with this: new URI(My_Url)

我试过: My_Url = My_Url.replace(^,\\ ^),但


  1. 这不是我需要的网址

  2. 它没有'工作

如何处理?

Frank

推荐答案

使用编码 ^ 字符,即。 http://finance.yahoo.com/q/h?s=%5EIXIC

Use % encoding for the ^ character, viz. http://finance.yahoo.com/q/h?s=%5EIXIC

这篇关于如何处理URISyntaxException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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