parent
f526567f70
commit
6e7901ecb3
|
@ -432,8 +432,9 @@ const wchar_t * WcharMbcsConvertor::char2wchar(const char * mbcs2Convert, size_t
|
|||
|
||||
const char* WcharMbcsConvertor::wchar2char(const wchar_t * wcharStr2Convert, size_t codepage, int lenWc, int* pLenMbcs)
|
||||
{
|
||||
if (nullptr == wcharStr2Convert)
|
||||
if (!wcharStr2Convert)
|
||||
return nullptr;
|
||||
|
||||
UINT cp = static_cast<UINT>(codepage);
|
||||
int lenMbcs = WideCharToMultiByte(cp, 0, wcharStr2Convert, lenWc, NULL, 0, NULL, NULL);
|
||||
if (lenMbcs > 0)
|
||||
|
@ -452,8 +453,9 @@ const char* WcharMbcsConvertor::wchar2char(const wchar_t * wcharStr2Convert, siz
|
|||
|
||||
const char * WcharMbcsConvertor::wchar2char(const wchar_t * wcharStr2Convert, size_t codepage, intptr_t* mstart, intptr_t* mend)
|
||||
{
|
||||
if (nullptr == wcharStr2Convert)
|
||||
if (!wcharStr2Convert)
|
||||
return nullptr;
|
||||
|
||||
UINT cp = static_cast<UINT>(codepage);
|
||||
int len = WideCharToMultiByte(cp, 0, wcharStr2Convert, -1, NULL, 0, NULL, NULL);
|
||||
if (len > 0)
|
||||
|
|
|
@ -2735,6 +2735,27 @@ void NppParameters::feedMacros(TiXmlNode *node)
|
|||
getActions(childNode, macro);
|
||||
int cmdID = ID_MACRO + static_cast<int32_t>(_macros.size());
|
||||
_macros.push_back(MacroShortcut(sc, macro, cmdID));
|
||||
|
||||
// User could add folder name in his/her native language,
|
||||
// so let's make non-western languages displayable here.
|
||||
if (!fdnm.empty())
|
||||
{
|
||||
// The function WideCharToMultiByte with CP_ACP doesn't work.
|
||||
// So we use our way to convert to char from wchar_t:
|
||||
size_t len = fdnm.size();
|
||||
const wchar_t* fdnmW = fdnm.c_str();
|
||||
char* fdnmA = new char[len+1];
|
||||
for (size_t i = 0; i < len; ++i)
|
||||
{
|
||||
fdnmA[i] = (char)fdnmW[i];
|
||||
}
|
||||
fdnmA[len] = '\0';
|
||||
|
||||
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
|
||||
fdnm = wmc.char2wchar(fdnmA, SC_CP_UTF8);
|
||||
|
||||
delete[] fdnmA;
|
||||
}
|
||||
_macroMenuItems.push_back(MenuItemUnit(cmdID, sc.getName(), fdnm));
|
||||
}
|
||||
}
|
||||
|
@ -2792,6 +2813,28 @@ void NppParameters::feedUserCmds(TiXmlNode *node)
|
|||
{
|
||||
int cmdID = ID_USER_CMD + static_cast<int32_t>(_userCommands.size());
|
||||
_userCommands.push_back(UserCommand(sc, cmdStr, cmdID));
|
||||
|
||||
// User could add folder name in his/her native language,
|
||||
// so let's make non-western languages displayable here.
|
||||
if (!fdnm.empty())
|
||||
{
|
||||
// The function WideCharToMultiByte with CP_ACP doesn't work.
|
||||
// So we use our way to convert to char from wchar_t:
|
||||
size_t len = fdnm.size();
|
||||
const wchar_t* fdnmW = fdnm.c_str();
|
||||
char* fdnmA = new char[len + 1];
|
||||
for (size_t i = 0; i < len; ++i)
|
||||
{
|
||||
fdnmA[i] = (char)fdnmW[i];
|
||||
}
|
||||
fdnmA[len] = '\0';
|
||||
|
||||
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
|
||||
fdnm = wmc.char2wchar(fdnmA, SC_CP_UTF8);
|
||||
|
||||
delete[] fdnmA;
|
||||
}
|
||||
|
||||
_runMenuItems.push_back(MenuItemUnit(cmdID, sc.getName(), fdnm));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -743,7 +743,7 @@ bool TiXmlDocument::LoadFile( const TCHAR* filename )
|
|||
data.reserve( length );
|
||||
|
||||
const int BUF_SIZE = 2048;
|
||||
TCHAR buf[BUF_SIZE];
|
||||
wchar_t buf[BUF_SIZE];
|
||||
|
||||
while(fgetws( buf, BUF_SIZE, file ) )
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue