You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by John Smith <jo...@gmail.com> on 2010/10/22 23:54:33 UTC

Re: Utf-8 encoded redirect url results in Invalid redirect URI and Illegal character in path (URISyntaxException)

Hi

I'm receiving an utf-8 encoded redirect url's from a website, but it
seems that httpclient (?) treat them as US-ASCII (?) so it can not
handle them correctly.

Is there any way to correct this behavior? Or is there any way to
convert incorrectly encoded string back to correct one (to be used in
a custom redirect handler)?

Sample url: http://www.khodnevis.org/permalink/9572.html

Wishes,

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Re: Utf-8 encoded redirect url results in Invalid redirect URI and Illegal character in path (URISyntaxException)

Posted by John Smith <jo...@gmail.com>.
 On Mon, Oct 25, 2010 at 11:51 AM, Oleg Kalnichevski <ol...@apache.org> wrote:
>
> One can set the 'http.protocol.element-charset' parameter to make
> HttpClient use a specific charset for protocol elements
>
> http://hc.apache.org/httpcomponents-client-ga/tutorial/html/fundamentals.html#d4e337
>
> Oleg
>

Thanks you Oleg! :)

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Re: Utf-8 encoded redirect url results in Invalid redirect URI and Illegal character in path (URISyntaxException)

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Sat, 2010-10-23 at 02:40 +0330, John Smith wrote:

...
> 
> Oleg,
> 
> Thanks for quick response, but I have not found any way to reformat an
> incorrectly encoded string. I doubt that this possible at all.
> 
> Is there any way to make HttpClient read headers as UTF-8 (even with
> modification to source code)?
> 

One can set the 'http.protocol.element-charset' parameter to make
HttpClient use a specific charset for protocol elements

http://hc.apache.org/httpcomponents-client-ga/tutorial/html/fundamentals.html#d4e337

Oleg



---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Re: Utf-8 encoded redirect url results in Invalid redirect URI and Illegal character in path (URISyntaxException)

Posted by John Smith <jo...@gmail.com>.
On Sat, Oct 23, 2010 at 1:34 AM, Oleg Kalnichevski <ol...@apache.org> wrote:
> On Sat, 2010-10-23 at 01:24 +0330, John Smith wrote:
>> Hi
>>
>> I'm receiving an utf-8 encoded redirect url's from a website, but it
>> seems that httpclient (?) treat them as US-ASCII (?) so it can not
>> handle them correctly.
>>
>
> URLs are not meant to have any characters other than US-ASCII.
> HttpClient's behavior is correct.
>
>
>> Is there any way to correct this behavior? Or is there any way to
>> convert incorrectly encoded string back to correct one (to be used in
>> a custom redirect handler)?
>>
>
> You can implement a custom redirect handler and reformat the redirect
> location as you see fit
>
> Hope this helps
>
> Oleg
>


Oleg,

Thanks for quick response, but I have not found any way to reformat an
incorrectly encoded string. I doubt that this possible at all.

Is there any way to make HttpClient read headers as UTF-8 (even with
modification to source code)?

Wishes,

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Re: Utf-8 encoded redirect url results in Invalid redirect URI and Illegal character in path (URISyntaxException)

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Sat, 2010-10-23 at 01:24 +0330, John Smith wrote:
> Hi
> 
> I'm receiving an utf-8 encoded redirect url's from a website, but it
> seems that httpclient (?) treat them as US-ASCII (?) so it can not
> handle them correctly.
> 

URLs are not meant to have any characters other than US-ASCII.
HttpClient's behavior is correct.


> Is there any way to correct this behavior? Or is there any way to
> convert incorrectly encoded string back to correct one (to be used in
> a custom redirect handler)?
> 

You can implement a custom redirect handler and reformat the redirect
location as you see fit

Hope this helps

Oleg



---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org