RFC2396 does list '^' as one of the 'unwise' characters. The inference
is that '^' should be escaped, though the RFC does not say so
explicitly.

The Java API docs on URI and URLencode, OTOH, recommend always using
URI rather than URLEncode, converting from URI to URL only as needed,
using toURL.

The API refs exact words:

Note, the URI class does perform escaping of its component fields in
certain circumstances. The recommended way to manage the encoding and
decoding of URLs is to use URI, and to convert between these two
classes using toURI() and URI.toURL().

The URLEncoder and URLDecoder classes can also be used, but only for
HTML form encoding, which is not the same as the encoding scheme
defined in RFC2396.

On Feb 13, 11:55 pm, ivanchan <[email protected]> wrote:
> Hi all,
>
> I am trying to use HttpGet to fetch some data from yahoo finace, the
> whole url is
> "http://finance.yahoo.com/q/hp?s=^DJI";, from the log I gucess it
> complains
> about the '^' character, what is the right way to solve this problem?
> Thanks.
>
> E/AndroidRuntime(  287): java.lang.IllegalArgumentException: Illegal
> character i
> n query at index 32:http://finance.yahoo.com/q/hp?s=^DJI
> E/AndroidRuntime(  287):        at java.net.URI.create(URI.java:970)
> E/AndroidRuntime(  287):        at
> org.apache.http.client.methods.HttpGet.<init>
> (HttpGet.java:75)
> E/AndroidRuntime(  287):        at
> Ivan.stock.droid.HttpHelper.connect(HttpHelpe
>
> Regards,
> Ivan

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en

Reply via email to