974a975
> 	bool unicode = ntlm->flags & NTLMFLAG_NEGOTIATE_UNICODE;
1012a1014,1019
> 	if (unicode) {
> 		domlen = domlen * 2;
> 		userlen = userlen * 2;
> 		hostlen = hostlen * 2;
> 	}
> 
1102,1108d1108
<     /*
<      * In the case the server sets the flag NTLMFLAG_NEGOTIATE_UNICODE, we
<      * need to filter it off because libcurl doesn't UNICODE encode the
<      * strings it packs into the NTLM authenticate packet.
<      */
<     ntlm->flags &= ~NTLMFLAG_NEGOTIATE_UNICODE;
< 
1236c1236,1244
<     memcpy(&ntlmbuf[size], domain, domlen);
---
> 	if (unicode) {
> 		size_t i;
> 		for (i=0; i<strlen(domain); i++) {
> 			ntlmbuf[size+2*i] = (unsigned char)domain[i];
> 			ntlmbuf[size+2*i+1] = '\0';
> 		}
> 	} else {
>     	memcpy(&ntlmbuf[size], domain, domlen);
> 	}
1240c1248,1256
<     memcpy(&ntlmbuf[size], user, userlen);
---
> 	if (unicode) {
> 		size_t i;
> 		for (i=0; i<strlen(user); i++) {
> 			ntlmbuf[size+2*i] = (unsigned char)user[i];
> 			ntlmbuf[size+2*i+1] = '\0';
> 		}
> 	} else {
>     	memcpy(&ntlmbuf[size], user, userlen);
> 	}
1244c1260,1268
<     memcpy(&ntlmbuf[size], host, hostlen);
---
> 	if (unicode) {
> 		size_t i;
> 		for (i=0; i<strlen(host); i++) {
> 			ntlmbuf[size+2*i] = (unsigned char)host[i];
> 			ntlmbuf[size+2*i+1] = '\0';
> 		}
> 	} else {
>     	memcpy(&ntlmbuf[size], host, hostlen);
> 	}

