Menu

Diff of /trunk/src/UnicodeUtils.cpp [r12] .. [r13]  Maximize  Restore

Switch to side-by-side view

--- a/trunk/src/UnicodeUtils.cpp
+++ b/trunk/src/UnicodeUtils.cpp
@@ -19,6 +19,20 @@
 	int size = len*4;
 	char * narrow = new char[size];
 	int ret = WideCharToMultiByte(CP_UTF8, 0, wide.c_str(), len, narrow, size-1, NULL, NULL);
+	narrow[ret] = 0;
+	std::string sRet = std::string(narrow);
+	delete narrow;
+	return sRet;
+}
+
+std::string CUnicodeUtils::StdGetANSI(const wide_string& wide)
+{
+	int len = (int)wide.size();
+	if (len==0)
+		return std::string();
+	int size = len*4;
+	char * narrow = new char[size];
+	int ret = WideCharToMultiByte(CP_ACP, 0, wide.c_str(), len, narrow, size-1, NULL, NULL);
 	narrow[ret] = 0;
 	std::string sRet = std::string(narrow);
 	delete narrow;