OSDN Git Service

merge original branch.
[tortoisegit/TortoiseGitJp.git] / src / Utils / UnicodeUtils.cpp
index 20aede4..acad667 100644 (file)
@@ -207,8 +207,14 @@ int CUnicodeUtils::GetCPCode(CString &codename)
 \r
        return CP_UTF8;\r
 }\r
+\r
 CStringA CUnicodeUtils::GetUTF8(const CStringW& string)\r
 {\r
+       return GetMulti(string,CP_UTF8);\r
+}\r
+\r
+CStringA CUnicodeUtils::GetMulti(const CStringW& string,int acp)\r
+{\r
        char * buf;\r
        CStringA retVal;\r
        int len = string.GetLength();\r
@@ -216,11 +222,12 @@ CStringA CUnicodeUtils::GetUTF8(const CStringW& string)
                return retVal;\r
        buf = retVal.GetBuffer(len*4 + 1);\r
 //     SecureZeroMemory(buf, (string.GetLength()*4 + 1)*sizeof(char));\r
-       int lengthIncTerminator = WideCharToMultiByte(CP_UTF8, 0, string, -1, buf, len*4, NULL, NULL);\r
+       int lengthIncTerminator = WideCharToMultiByte(acp, 0, string, -1, buf, len*4, NULL, NULL);\r
        retVal.ReleaseBuffer(lengthIncTerminator-1);\r
        return retVal;\r
 }\r
 \r
+\r
 CStringA CUnicodeUtils::GetUTF8(const CStringA& string)\r
 {\r
        WCHAR * buf;\r