curl-users
Re: HTTP post problem with quoted string as param
Date: Fri, 2 Dec 2011 16:08:54 +0530
The point "treat %e2%80%9cQuote%203%e2%80%9d" as ISO-8859-1 is not clear to
me.
On converting "Quote 3" to UTF-8 in my C++ app I get the encoded string as
%e2%80%9cQuote%203%e2%80%9d
So, %e2%80%9cQuote%203%e2%80%9d is basically UTF-8.
Now I am posting this UTF-8 encoded string to server through HTTP post.
On the server (Apache Tomcat) side I had tried setting the content-type to
ISO-8859-1 but received junkQuotejunk.
UTF-8 as content-type also yielded same.
So, when sending the UTF-8 encoded string should I set any encoding type in
C++ using curl.
Also, what encoding type should I set on server side?
I tried this:
C++ side
Curl post parameter: mystring=%e2%80%9cQuote%203%e2%80%9d
Servlet side
request.setContentType("text/html", charset=ISO-8859-1);
Now, request.getParameter("mystring") yielded
%C3%A2%C2%80%C2%9CQuote%203%C3%A2%C2%80%C2%9D
Tried, URIDecoder.decode(request.getParameter("mystring"), "ISO-8859-1")
yielded junkQuotejunk
In short, what encoding type should I set at C++ side using CURL and also
at server side?
Kindly help!
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ: http://curl.haxx.se/docs/faq.html
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-12-02