Treat the strings for simple dialogs as UTF-8 on Windows.

On Windows, filename strings inside Wireshark are UTF-8 strings, so
error messages containing file names are UTF-8 strings.  Convert from
UTF-8, not from the local code page.

Bug: 15367
Change-Id: I52f3de2606ec6a592e7cb82b1a9aaeeef8acecef
Reviewed-on: https://code.wireshark.org/review/31090
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
Guy Harris 2018-12-18 00:49:21 -08:00
parent c0a28448a5
commit ae83101dd5
1 changed files with 12 additions and 0 deletions

View File

@ -163,7 +163,19 @@ SimpleDialog::SimpleDialog(QWidget *parent, ESD_TYPE_E type, int btn_mask, const
QString message;
vmessage = g_strdup_vprintf(msg_format, ap);
#ifdef _WIN32
//
// On Windows, filename strings inside Wireshark are UTF-8 strings,
// so error messages containing file names are UTF-8 strings. Convert
// from UTF-8, not from the local code page.
//
message = QString().fromUtf8(vmessage, -1);
#else
//
// On UN*X, who knows? Assume the locale's encoding.
//
message = QTextCodec::codecForLocale()->toUnicode(vmessage);
#endif
g_free(vmessage);
MessagePair msg_pair = splitMessage(message);