summaryrefslogtreecommitdiff
path: root/src/dlls/mscoree/unixinterface.cpp
diff options
context:
space:
mode:
authorJan Vorlicek <janvorli@microsoft.com>2016-05-11 02:15:45 +0200
committerJan Vorlicek <janvorli@microsoft.com>2016-05-11 02:15:45 +0200
commit5c3d1efea4a8673086df4ba36267d7f580ba9c8c (patch)
tree481ca84d17ed4cd977945b77dde994f27f30edc0 /src/dlls/mscoree/unixinterface.cpp
parent99c79ff3703439126a31216d056b44d6ef877ab7 (diff)
downloadcoreclr-5c3d1efea4a8673086df4ba36267d7f580ba9c8c.tar.gz
coreclr-5c3d1efea4a8673086df4ba36267d7f580ba9c8c.tar.bz2
coreclr-5c3d1efea4a8673086df4ba36267d7f580ba9c8c.zip
Change hosting API string encoding to UTF-8 on Windows (#4894)
This change fixes a problem with the string encoding in the hosting API using CP_ACP, which causes problem when the input is a string in other language than the current Windows one. In such case, it loses some characters. The fix is to use UTF-8 encoding (which is what CP_ACP means on Unix PAL too).
Diffstat (limited to 'src/dlls/mscoree/unixinterface.cpp')
-rw-r--r--src/dlls/mscoree/unixinterface.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/dlls/mscoree/unixinterface.cpp b/src/dlls/mscoree/unixinterface.cpp
index deccae874f..42f2d80054 100644
--- a/src/dlls/mscoree/unixinterface.cpp
+++ b/src/dlls/mscoree/unixinterface.cpp
@@ -56,13 +56,13 @@ public:
// Convert 8 bit string to unicode
static LPCWSTR StringToUnicode(LPCSTR str)
{
- int length = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
+ int length = MultiByteToWideChar(CP_UTF8, 0, str, -1, NULL, 0);
ASSERTE_ALL_BUILDS(length != 0);
LPWSTR result = new (nothrow) WCHAR[length];
ASSERTE_ALL_BUILDS(result != NULL);
- length = MultiByteToWideChar(CP_ACP, 0, str, -1, result, length);
+ length = MultiByteToWideChar(CP_UTF8, 0, str, -1, result, length);
ASSERTE_ALL_BUILDS(length != 0);
return result;