[PATCH 3/3] Fix response text conversion to WCHAR string

Nikolay Sivov nsivov at codeweavers.com
Sun Oct 10 08:17:15 CDT 2010


---
 dlls/msxml3/httprequest.c  |    6 +++++-
 dlls/msxml3/tests/domdoc.c |    2 +-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/dlls/msxml3/httprequest.c b/dlls/msxml3/httprequest.c
index a995078..a0d3bb3 100644
--- a/dlls/msxml3/httprequest.c
+++ b/dlls/msxml3/httprequest.c
@@ -859,7 +859,11 @@ static HRESULT WINAPI httprequest_get_responseText(IXMLHTTPRequest *iface, BSTR
         if (encoding == XML_CHAR_ENCODING_UTF8 ||
             encoding == XML_CHAR_ENCODING_NONE )
         {
-            *body = bstr_from_xmlChar(ptr);
+            DWORD length = MultiByteToWideChar(CP_UTF8, 0, (LPCSTR)ptr, size, NULL, 0);
+
+            *body = SysAllocStringLen(NULL, length);
+            if (*body)
+                MultiByteToWideChar( CP_UTF8, 0, (LPCSTR)ptr, size, *body, length);
         }
         else
             *body = SysAllocStringByteLen((LPCSTR)ptr, size);
diff --git a/dlls/msxml3/tests/domdoc.c b/dlls/msxml3/tests/domdoc.c
index 4cb9abe..fd56c61 100644
--- a/dlls/msxml3/tests/domdoc.c
+++ b/dlls/msxml3/tests/domdoc.c
@@ -3354,7 +3354,7 @@ if (0)
      * not what the server expects */
     if(hr == S_OK)
     {
-        todo_wine ok(!memcmp(bstrResponse, wszExpectedResponse, sizeof(wszExpectedResponse)),
+        ok(!memcmp(bstrResponse, wszExpectedResponse, sizeof(wszExpectedResponse)),
             "expected %s, got %s\n", wine_dbgstr_w(wszExpectedResponse), wine_dbgstr_w(bstrResponse));
         SysFreeString(bstrResponse);
     }
-- 
1.5.6.5



--------------090709010303090404090900--



More information about the wine-patches mailing list