Index: trunk/ab5.0/jenga/src/common/String.cpp
===================================================================
--- trunk/ab5.0/jenga/src/common/String.cpp	(revision 747)
+++ trunk/ab5.0/jenga/src/common/String.cpp	(revision 748)
@@ -35,11 +35,17 @@
 std::string Jenga::Common::ToString( const std::wstring &wstr )
 {
-	char *pstr = (char *)malloc( wstr.length() + 1 );
-
-	WideCharToMultiByte(
-		CP_ACP,
+	int needSize = 	WideCharToMultiByte(
+		CP_THREAD_ACP,
 		0,
 		wstr.c_str(), -1,
-		pstr, static_cast<int>(wstr.length()) + 1,
+		NULL, NULL,
+		NULL, NULL );
+
+	char *pstr = (char *)calloc( needSize + 1, 1 );
+	WideCharToMultiByte(
+		CP_THREAD_ACP,
+		0,
+		wstr.c_str(), -1,
+		pstr, needSize,
 		NULL, NULL );
 
