curl-library
RE: multibyte character support
Date: Wed, 28 Jan 2004 22:55:38 +0100 (CET)
On Wed, 28 Jan 2004, Jonathan Bourgeois wrote:
> Yes I can elaborate. Let us assume that the input I've gathered from a user
> is some Japanese representation of an item code, perhaps the name "Tokyo".
> The data I am posting to the server would then be something like:
> itemCode=tokyo. I have to properly wrap this data. In my application, I
> have defined a "smartchar" which, depending on compile options either will
> be a standard char, or a wchar_t. My dilemma then becomes doing the
> following:
>
> smartchar* data = getDataFromUser();
> curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data);
>
> Will the above call properly handle what I have passed? For the sake of
> discussion, I have included my definition of smartchar below:
This particular case might fail if the data contains a zero-byte that you want
to include in the data you send (not that URL-encoded data can legally contain
zero bytes). So if doing strlen() isn't good enough to find the size, you must
also set CURLOPT_POSTFIELDSIZE.
Then it'll work!
-- Daniel Stenberg -- http://curl.haxx.se/ -- http://daniel.haxx.se/ [[ Do not send mails to this email address. They won't reach me. ]] ------------------------------------------------------- The SF.Net email is sponsored by EclipseCon 2004 Premiere Conference on Open Tools Development and Integration See the breadth of Eclipse activity. February 3-5 in Anaheim, CA. http://www.eclipsecon.org/osdnReceived on 2004-01-29