I am developing a Windows based application in which I need to pass unicode characters as part of the URL. I read that I need to percent encode them inorder to do so. According to my understanding windows programs are use UCS-2
encoding so I need to convert the characters to first to UTF-8
and then percent encode them. I tried using MultiByteToWideChar
along with UrlEscape
without much success. Can anybody tell me what is the correct way to do this?
Asked
Active
Viewed 1,307 times
1

Asha
- 11,002
- 6
- 44
- 66
-
Maybe redundant to http://stackoverflow.com/q/3300025/1758762 – Leo Chapiro Mar 10 '13 at 14:09
-
1It *looks* like you're trying at least toward right direction. Did you consider using the wininet library (specifically, [InternetCanonicaliizeUrl()](http://msdn.microsoft.com/en-us/library/windows/desktop/aa384342(v=vs.85).aspx))? Or is that off the table? – WhozCraig Mar 10 '13 at 14:21
-
1To convert from UCS-2 (UTF-16, actually) to UTF-8, you'll need `WideCharToMultiByte`. – nwellnhof Mar 10 '13 at 14:39
-
You also need to ensure the receiving code expects URL encoded UTF-8. HTTP doesn't care how it's encoded, as long as it's valid data. It can be base64 encoded morse if you wish as long as both ends agree :) – Deanna Mar 11 '13 at 14:36