diff -Nur -x '*.orig' -x '*~' libsoup2.4-2.4.1/libsoup/soup-auth-manager-ntlm.c libsoup2.4-2.4.1.new/libsoup/soup-auth-manager-ntlm.c
--- libsoup2.4-2.4.1/libsoup/soup-auth-manager-ntlm.c	2008-04-05 19:08:01.000000000 +0200
+++ libsoup2.4-2.4.1.new/libsoup/soup-auth-manager-ntlm.c	2009-03-26 11:08:28.000000000 +0100
@@ -12,6 +12,7 @@
 
 #include <ctype.h>
 #include <string.h>
+#include <glib.h>
 
 #include "soup-auth-manager-ntlm.h"
 #include "soup-auth-ntlm.h"
@@ -392,7 +393,7 @@
 #define NTLM_CHALLENGE_DOMAIN_STRING_OFFSET 12
 
 #define NTLM_RESPONSE_HEADER "NTLMSSP\x00\x03\x00\x00\x00"
-#define NTLM_RESPONSE_FLAGS 0x8202
+#define NTLM_RESPONSE_FLAGS 0x8201
 
 typedef struct {
         guchar     header[12];
@@ -418,7 +419,7 @@
 static char *
 soup_ntlm_request (void)
 {
-	return g_strdup ("NTLM TlRMTVNTUAABAAAABoIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAA");
+	return g_strdup ("NTLM TlRMTVNTUAABAAAABYIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAA");
 }
 
 static gboolean
@@ -450,7 +451,9 @@
 			return FALSE;
 		}
 
-		*default_domain = g_strndup ((char *)chall + domain.offset, domain.length);
+		const gchar *charset;
+		g_get_charset (&charset);
+		*default_domain = g_convert ((char *)chall + domain.offset, domain.length, charset, "UCS-2LE", NULL, NULL, NULL);
 	}
 
 	if (nonce) {
@@ -486,13 +489,17 @@
 
 	offset = sizeof (resp);
 
-	dlen = strlen (domain);
-	ntlm_set_string (&resp.domain, &offset, dlen);
-	ulen = strlen (user);
-	ntlm_set_string (&resp.user, &offset, ulen);
+	const gchar *charset;
+	g_get_charset (&charset);
+
 	if (!host)
 		host = "UNKNOWN";
-	hlen = strlen (host);
+	char *domain_conv = g_convert (domain, -1, "UCS-2LE", charset, NULL, &dlen, NULL);
+	char *user_conv = g_convert (user, -1, "UCS-2LE", charset, NULL, &ulen, NULL);
+	char *host_conv = g_convert (host, -1, "UCS-2LE", charset, NULL, &hlen, NULL);
+
+	ntlm_set_string (&resp.domain, &offset, dlen);
+	ntlm_set_string (&resp.user, &offset, ulen);
 	ntlm_set_string (&resp.host, &offset, hlen);
 	ntlm_set_string (&resp.lm_resp, &offset, sizeof (lm_resp));
 	ntlm_set_string (&resp.nt_resp, &offset, sizeof (nt_resp));
@@ -505,11 +512,11 @@
 
 	p += g_base64_encode_step ((const guchar *) &resp, sizeof (resp), 
 				   FALSE, p, &state, &save);
-	p += g_base64_encode_step ((const guchar *) domain, dlen, 
+	p += g_base64_encode_step ((const guchar *) domain_conv, dlen, 
 				   FALSE, p, &state, &save);
-	p += g_base64_encode_step ((const guchar *) user, ulen, 
+	p += g_base64_encode_step ((const guchar *) user_conv, ulen, 
 				   FALSE, p, &state, &save);
-	p += g_base64_encode_step ((const guchar *) host, hlen, 
+	p += g_base64_encode_step ((const guchar *) host_conv, hlen, 
 				   FALSE, p, &state, &save);
 	p += g_base64_encode_step (lm_resp, sizeof (lm_resp), 
 				   FALSE, p, &state, &save);
@@ -518,6 +525,10 @@
 	p += g_base64_encode_close (FALSE, p, &state, &save);
 	*p = '\0';
 
+	g_free(domain_conv);
+	g_free(user_conv);
+	g_free(host_conv);
+
 	return out;
 }
 
