Use current encoding for char command line arguments if possible
This is more consistent with the conversion in the other direction, but here we also fall back to UTF-8 if conversion fails as it seems better than just losing the argument entirely. Also make the conversion a bit more efficient by stealing the pointer from wxCharBuffer instead of using strdup() to copy the string.
This commit is contained in:
parent
1d134338a7
commit
a4ee2563bc
1 changed files with 3 additions and 1 deletions
|
|
@ -240,7 +240,9 @@ void wxInitData::InitIfNecessary(int argcIn, wchar_t** argvIn)
|
|||
|
||||
for ( int i = 0; i < argc; i++ )
|
||||
{
|
||||
argvA[i] = wxStrdup(wxConvUTF8.cWC2MB(argv[i]));
|
||||
// Try to use the current encoding, but if it fails, it's better to
|
||||
// fall back to UTF-8 than lose an argument entirely.
|
||||
argvA[i] = wxConvWhateverWorks.cWC2MB(argvIn[i]).release();
|
||||
}
|
||||
#endif // __WINDOWS__/!__WINDOWS__
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue