fix for non unicode locales
This commit is contained in:
@@ -646,9 +646,9 @@ char * ToString(const wchar_t *ws)
|
|||||||
string s;
|
string s;
|
||||||
for (int i = 0; i < wcslen(ws); i++)
|
for (int i = 0; i < wcslen(ws); i++)
|
||||||
{
|
{
|
||||||
char *c = new char[MB_CUR_MAX]();
|
char *c = new char[MB_CUR_MAX+1]();
|
||||||
wctomb(c, ws[i]);
|
if (wctomb(c, ws[i]) > 0)
|
||||||
s += c;
|
s += c;
|
||||||
delete [] c;
|
delete [] c;
|
||||||
}
|
}
|
||||||
char *result = strdup(s.c_str());
|
char *result = strdup(s.c_str());
|
||||||
@@ -667,9 +667,9 @@ string ToString(const wstring &ws)
|
|||||||
string s;
|
string s;
|
||||||
for (wstring::const_iterator it = ws.begin(); it != ws.end(); it++)
|
for (wstring::const_iterator it = ws.begin(); it != ws.end(); it++)
|
||||||
{
|
{
|
||||||
char *c = new char[MB_CUR_MAX]();
|
char *c = new char[MB_CUR_MAX+1]();
|
||||||
wctomb(c, *it);
|
if (wctomb(c, *it) > 0)
|
||||||
s += c;
|
s += c;
|
||||||
delete [] c;
|
delete [] c;
|
||||||
}
|
}
|
||||||
return s;
|
return s;
|
||||||
|
|||||||
Reference in New Issue
Block a user