summaryrefslogtreecommitdiffstats
path: root/shell/source/win32/shlxthandler/util/utilities.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'shell/source/win32/shlxthandler/util/utilities.cxx')
-rw-r--r--shell/source/win32/shlxthandler/util/utilities.cxx42
1 files changed, 30 insertions, 12 deletions
diff --git a/shell/source/win32/shlxthandler/util/utilities.cxx b/shell/source/win32/shlxthandler/util/utilities.cxx
index a92a69cce8aa..c62ec833b4fc 100644
--- a/shell/source/win32/shlxthandler/util/utilities.cxx
+++ b/shell/source/win32/shlxthandler/util/utilities.cxx
@@ -32,36 +32,30 @@
const size_t MAX_RES_STRING = 1024;
const wchar_t SPACE_CHAR = _T(' ');
-//---------------------------------
-/**
-*/
-std::wstring StringToWString(const std::string& String)
+static std::wstring StringToWString(const std::string& String, int codepage)
{
int len = MultiByteToWideChar(
- CP_ACP, 0, String.c_str(), -1, 0, 0);
+ codepage, 0, String.c_str(), -1, 0, 0);
wchar_t* buff = reinterpret_cast<wchar_t*>(
_alloca(len * sizeof(wchar_t)));
MultiByteToWideChar(
- CP_ACP, 0, String.c_str(), -1, buff, len);
+ codepage, 0, String.c_str(), -1, buff, len);
return std::wstring(buff);
}
-//---------------------------------
-/**
-*/
-std::string WStringToString(const std::wstring& String)
+static std::string WStringToString(const std::wstring& String, int codepage)
{
int len = WideCharToMultiByte(
- CP_ACP, 0, String.c_str(), -1, 0, 0, 0, 0);
+ codepage, 0, String.c_str(), -1, 0, 0, 0, 0);
char* buff = reinterpret_cast<char*>(
_alloca(len * sizeof(char)));
WideCharToMultiByte(
- CP_ACP, 0, String.c_str(), -1, buff, len, 0, 0);
+ codepage, 0, String.c_str(), -1, buff, len, 0, 0);
return std::string(buff);
}
@@ -69,6 +63,30 @@ std::string WStringToString(const std::wstring& String)
//---------------------------------
/**
*/
+std::wstring StringToWString(const std::string& String)
+{
+ return StringToWString(String, CP_ACP);
+}
+
+//---------------------------------
+/**
+*/
+std::string WStringToString(const std::wstring& String)
+{
+ return WStringToString(String, CP_ACP);
+}
+
+//---------------------------------
+/**
+*/
+std::wstring UTF8ToWString(const std::string& String)
+{
+ return StringToWString(String, CP_UTF8);
+}
+
+//---------------------------------
+/**
+*/
std::wstring GetResString(int ResId)
{
wchar_t szResStr[MAX_RES_STRING];