0

I am trying to use the WinHTTP library with Basic Authentication. I'm testing the case where the user name or password has "special" characters (ie, not in Windows-1252) and I cannot seem to set the credentials using WinHttpSetCredentials

The outcome is an error, with code 87 ("The parameter is incorrect")

'extended ascii' (128~255) in the sense of Windows-1252 will work.

I've sniffed the headers, and it seems like WinHTTP re-encodes my user/pass in Windows-1252.

My call looks like this, and it returns false when user or pass have non-Win1252 characters.

::WinHttpSetCredentials(requestHdl, dwTarget, m_authScheme /*basic*/,
     user.c_str() /*wstring in UCS2*/,
     pass.c_str(), /*wstring in UCS2*/ 
     NULL /*reserved?*/)

Any suggestions as to why this call doesn't support general wstring characters properly? I can't find anything in the documentation (except for a strange flag about assuming the data is ASCII...).

JamEnergy
  • 720
  • 8
  • 21
  • If you compile the code with a C++ compilert it **is not C**, but C++. Identical syntax/grammar does not imply identical semantics! They are different languages, C++ is not a superset of C. – too honest for this site Jul 20 '18 at 14:49
  • @toohonestforthissite Ok, thanks. I get that. I was confused on what to call it, since the crux of the question is platform specific anyway. That's to say that the semantics of C vs C++ are not important to this question, so using one or the other doesn't really communicate better or worse, I'd say. – JamEnergy Aug 01 '18 at 15:10

0 Answers0