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 sandy801 <sa...@gmail.com> on 2010/01/12 10:27:39 UTC

escaped absolute path not valid error with URLs having GB18030 or japansese characters in them

Hi,
I have a PostMethod instance, to which I set URI using set URI API. This
always gives error "escaped absolute path not valid" whenever URL has
chinese or japanese characters in it. How do I make sure URI for POSTMethod
is executed properly. 

I tried sing HTTPMethodParams to set charset for HTTP ELEMENT and HTTP URL
Charset but no use.
Here is code snippet. 

PostMethod method = new PostMethod();

HttpMethodParams params = new HttpMethodParams();
 method.addParameter(HttpMethodParams.HTTP_ELEMENT_CHARSET, "UTF-8");
 method.addParameter(HttpMethodParams.HTTP_URI_CHARSET, "UTF-8");

method.setURI(new URI(urlString));//This call fails

please help.

thanks,
Sandeep




-- 
View this message in context: http://old.nabble.com/escaped-absolute-path-not-valid-error-with-URLs-having-GB18030-or-japansese-characters-in-them-tp27124775p27124775.html
Sent from the HttpClient-User mailing list archive at Nabble.com.


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


Re: escaped absolute path not valid error with URLs having GB18030 or japansese characters in them

Posted by sandy801 <sa...@gmail.com>.
Hi Ken,
Thanks for your response.
I am using HTTP client 3.1 and I get this exception from validate method of
URI class(URIException of code URIException.ESCAPING). Issue is the GB18030
chars are notpart of generous BITSet pased to validate method, and it fails
there.

thanks,
Sandeep


Ken Krugler wrote:
> 
> Hi Sandeep,
> 
> 1. What version of HttpClient are you using? I didn't find "escaped  
> absolute path not valid" in the 4.0 source.
> 
> 2. What version of the JRE are you running? I also couldn't find your  
> error message in the JDK 1.6 source, and HttpClient 4.0's setURI  
> method just copies the URI to a method variable, so I'm assuming it's  
> the call to the URI class constructor that's failing.
> 
> 3. Have you used URLEncoder to encode your urlString using UTF-8?
> 
> -- Ken
> 
> On Jan 12, 2010, at 1:27am, sandy801 wrote:
> 
>>
>> Hi,
>> I have a PostMethod instance, to which I set URI using set URI API.  
>> This
>> always gives error "escaped absolute path not valid" whenever URL has
>> chinese or japanese characters in it. How do I make sure URI for  
>> POSTMethod
>> is executed properly.
>>
>> I tried sing HTTPMethodParams to set charset for HTTP ELEMENT and  
>> HTTP URL
>> Charset but no use.
>> Here is code snippet.
>>
>> PostMethod method = new PostMethod();
>>
>> HttpMethodParams params = new HttpMethodParams();
>> method.addParameter(HttpMethodParams.HTTP_ELEMENT_CHARSET, "UTF-8");
>> method.addParameter(HttpMethodParams.HTTP_URI_CHARSET, "UTF-8");
>>
>> method.setURI(new URI(urlString));//This call fails
>>
>> please help.
>>
>> thanks,
>> Sandeep
>>
>>
>>
>>
>> -- 
>> View this message in context:
>> http://old.nabble.com/escaped-absolute-path-not-valid-error-with-URLs-having-GB18030-or-japansese-characters-in-them-tp27124775p27124775.html
>> Sent from the HttpClient-User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
>> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>>
> 
> --------------------------------------------
> Ken Krugler
> +1 530-210-6378
> http://bixolabs.com
> e l a s t i c   w e b   m i n i n g
> 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/escaped-absolute-path-not-valid-error-with-URLs-having-GB18030-or-japansese-characters-in-them-tp27124775p27286203.html
Sent from the HttpClient-User mailing list archive at Nabble.com.


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


Re: escaped absolute path not valid error with URLs having GB18030 or japansese characters in them

Posted by Ken Krugler <kk...@transpac.com>.
Hi Sandeep,

1. What version of HttpClient are you using? I didn't find "escaped  
absolute path not valid" in the 4.0 source.

2. What version of the JRE are you running? I also couldn't find your  
error message in the JDK 1.6 source, and HttpClient 4.0's setURI  
method just copies the URI to a method variable, so I'm assuming it's  
the call to the URI class constructor that's failing.

3. Have you used URLEncoder to encode your urlString using UTF-8?

-- Ken

On Jan 12, 2010, at 1:27am, sandy801 wrote:

>
> Hi,
> I have a PostMethod instance, to which I set URI using set URI API.  
> This
> always gives error "escaped absolute path not valid" whenever URL has
> chinese or japanese characters in it. How do I make sure URI for  
> POSTMethod
> is executed properly.
>
> I tried sing HTTPMethodParams to set charset for HTTP ELEMENT and  
> HTTP URL
> Charset but no use.
> Here is code snippet.
>
> PostMethod method = new PostMethod();
>
> HttpMethodParams params = new HttpMethodParams();
> method.addParameter(HttpMethodParams.HTTP_ELEMENT_CHARSET, "UTF-8");
> method.addParameter(HttpMethodParams.HTTP_URI_CHARSET, "UTF-8");
>
> method.setURI(new URI(urlString));//This call fails
>
> please help.
>
> thanks,
> Sandeep
>
>
>
>
> -- 
> View this message in context: http://old.nabble.com/escaped-absolute-path-not-valid-error-with-URLs-having-GB18030-or-japansese-characters-in-them-tp27124775p27124775.html
> Sent from the HttpClient-User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>

--------------------------------------------
Ken Krugler
+1 530-210-6378
http://bixolabs.com
e l a s t i c   w e b   m i n i n g





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