diff options
author | Guy Harris <guy@alum.mit.edu> | 2018-12-18 00:49:21 -0800 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2018-12-18 09:49:15 +0000 |
commit | ae83101dd5643c3852ca67ffb331cd8dbd20c727 (patch) | |
tree | 8a0d44397a78cc9e5f939a19823c39267bc16f90 /ui | |
parent | c0a28448a57ca67892fdcd5c3fbc2d6f0182e310 (diff) |
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>
Diffstat (limited to 'ui')
-rw-r--r-- | ui/qt/simple_dialog.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/ui/qt/simple_dialog.cpp b/ui/qt/simple_dialog.cpp index a76cbea2c9..3565be3c48 100644 --- a/ui/qt/simple_dialog.cpp +++ b/ui/qt/simple_dialog.cpp @@ -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); |