I need a library that can URLencode a string/char array.
Now, I can hex encode an ASCII array like here:
http://www.codeguru.com/cpp/cpp/cpp_mfc/article.php/c4029
But I need something that works with Unicode.
Note: On Linux AND on Windows !
CURL has a quite nice:
char *encodedURL = curl_easy_escape(handle,WEBPAGE_URL, strlen(WEBPAGE_URL));
but first, that needs CURL and it also is not unicode capable, as one sees by strlen
If I read the quest correctly and you want to do this yourself, without using curl I think I have a solution (sssuming UTF-8) and I think this is a conformant and portable way of URL encoding query strings:
It has no non-standard dependencies other than boost and if you don’t like the boost dependency it’s not that hard to remove.
I tested it using:
Which all seemed to work:
Becomes:
Which squares with these examples