don't do char*->wchar_t*>char* roundtrip in wxArgNormalizerUtf8<const char*> if current locale uses UTF-8

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45787 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík 2007-05-03 14:34:29 +00:00
parent 9d0e03774e
commit f461887a02

View File

@ -238,14 +238,19 @@ struct wxArgNormalizerUtf8<const char*>
{
wxArgNormalizerUtf8(const char* s)
{
// FIXME-UTF8: optimize this if current locale is UTF-8 one
if ( wxLocaleIsUtf8 )
{
m_value = wxCharBuffer::CreateNonOwned(s);
}
else
{
// convert to widechar string first:
wxWCharBuffer buf(wxConvLibc.cMB2WC(s));
// convert to widechar string first:
wxWCharBuffer buf(wxConvLibc.cMB2WC(s));
// then to UTF-8:
if ( buf )
m_value = wxConvUTF8.cWC2MB(buf);
// then to UTF-8:
if ( buf )
m_value = wxConvUTF8.cWC2MB(buf);
}
}
};