Thanks Ken for your response
http://<server>:8080/apache-solr-1.3.0/CORE_WWW.PUFFIN.CO.UK/select/?q=Index_Type_s%3AproductIndex+AND+%28test_raman_sub%20Âpple%29&spellcheck=true&start=0&rows=10&qt=dismaxrequest
I have tried to set charset:
objGetMethod.setRequestHeader("Content-Type", "text/plain; charset=" +
"UTF-8");
objGetMethod.setFollowRedirects(true);
But still I am facing "org.apache.commons.httpclient.URIException: Invalid
query" issue
We can not encode "Â" character since Apache Solr --accent normalization
will not work after encoding.
Please advice
~Vikrant
Ken Krugler wrote:
>
> Hi Vikrant,
>
> On Aug 12, 2009, at 4:26am, Vicky_Dev wrote:
>
>> I am facing similar issue whilst calling Solr (search engine) with
>> HTTPClient
>>
>> Following URL works very well within browser
>>
>> http://<server>:8080/apache-solr-1.3.0/CORE_WWW.PUFFIN.CO.UK/select/?
>> q=Index_Type_s%3AproductIndex+AND+%28test_raman_sub%20Âpple
>> %29&spellcheck=true&start=0&rows=10&qt=dismaxrequest
>>
>> But same URL is not coming up from HTTPClient.
>>
>> Error:
>> org.apache.commons.httpclient.URIException: Invalid query
>
> I'm assuming the issue for your URL is that "Âpple" has a non-escaped
> character in it, and the encoding being used to process the URL is
> something other than UTF-8.
>
> But I'm using HttpClient 4.x currently, and don't have the 3.x source
> handy - which it looks like you're using.
>
> One other inline comment below, from the older email question you
> referenced
>
> [snip]
>
>>> 在2009-03-30,"Oleg Kalnichevski" <[email protected]> 写道:
>>>> On Sat, 2009-03-28 at 22:50 +0800, nonopo12345 wrote:
>>>>>
>>>>> Hi,i'm using httpclient to connect a url. The problem is that i
>>>>> accept a
>>>>> error redirect location ,for example http://wapp.baidu.com/f?
>>>>> kw=????????
>>>>> , when to visit the url.
>>>>>
>>>>> why there appeared some characters like "???????? "? The correct
>>>>> redirect laoction should be
>>>>> http://wapp.baidu.com/f?kw=%B9%C2%D1%E3%B0%A7%C3%F9.
>>>>
>>>> This is most likely because the redirect location in the HTTP
>>>> response
>>>> is not correctly escaped. HTTP messages are expected to consist of
>>>> US-ASCII characters only. Non-US-ASCII characters are supposed to be
>>>> escaped.
>>>>
>>>> Oleg
>>>
>>> how can httpclient escape Non-US-ASCII characters correctly ?
>
> This isn't an issue with HttpClient.
>
> The problem is that the server is sending back an invalid redirect URL
> (in the response header), where it hasn't been properly encoded as US-
> ASCII.
>
> When HttpClient tries to automatically follow this redirect, it runs
> into problems.
>
> To fix this, you'd have to disable auto-following of redirects, then
> handle the redirect response yourself. If you set things up this way,
> you could try to detect improperly encoded redirect URLs in the
> response header, and fix them up before following them.
>
> -- Ken
>
> --------------------------
> Ken Krugler
> TransPac Software, Inc.
> <http://www.transpac.com>
> +1 530-210-6378
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>
>
--
View this message in context:
http://www.nabble.com/Invalid-redirect-location%3A-http%3A--wapp.baidu.com-f-kw%3D--------tp22757662p25017600.html
Sent from the HttpClient-User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]