aboutsummaryrefslogtreecommitdiffstats
path: root/wireshark-qt.cpp
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2015-06-16 11:55:09 -0700
committerGerald Combs <gerald@wireshark.org>2015-06-16 18:58:54 +0000
commit6c4ec4aedbe94505d9262952b02f5c7faeb77868 (patch)
tree81dc92ffe43e6ea38dbbaf3fbb06d04eb925731d /wireshark-qt.cpp
parent200c15e96dd84bdc8d6f856b262d726d752594d4 (diff)
downloadwireshark-6c4ec4aedbe94505d9262952b02f5c7faeb77868.tar.gz
wireshark-6c4ec4aedbe94505d9262952b02f5c7faeb77868.tar.bz2
wireshark-6c4ec4aedbe94505d9262952b02f5c7faeb77868.zip
Qt: Make sure we have usable command line arguments.
Call arg_list_utf_16to8 in wireshark-qt.cpp on Windows. Set our default codec in Qt4 to UTF-8 before doing so. Bug: 11276 Change-Id: I8e0afb9523ddb5956d30424b7b7ad7f3ea0838c7 Reviewed-on: https://code.wireshark.org/review/8954 Reviewed-by: Gerald Combs <gerald@wireshark.org>
Diffstat (limited to 'wireshark-qt.cpp')
-rw-r--r--wireshark-qt.cpp27
1 files changed, 16 insertions, 11 deletions
diff --git a/wireshark-qt.cpp b/wireshark-qt.cpp
index aa2859bec4..4fdb22d15c 100644
--- a/wireshark-qt.cpp
+++ b/wireshark-qt.cpp
@@ -49,6 +49,7 @@
#endif
#include <wsutil/report_err.h>
#include <wsutil/u3.h>
+#include <wsutil/unicode-utils.h>
#include <wsutil/ws_diag_control.h>
#include <wsutil/ws_version_info.h>
@@ -463,9 +464,23 @@ int main(int argc, char *argv[])
cmdarg_err_init(wireshark_cmdarg_err, wireshark_cmdarg_err_cont);
+ // In Qt 5, C strings are treated always as UTF-8 when converted to
+ // QStrings; in Qt 4, the codec must be set to make that happen
+#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
+ // Hopefully we won't have to use QString::fromUtf8() in as many places.
+ QTextCodec *utf8codec = QTextCodec::codecForName("UTF-8");
+ QTextCodec::setCodecForCStrings(utf8codec);
+ // XXX - QObject doesn't *have* a tr method in 5.0, as far as I can see...
+ QTextCodec::setCodecForTr(utf8codec);
+#endif
+
+ /* Set the C-language locale to the native environment. */
+ // The GTK+ UI calls this. Should we as well?
+ //setlocale(LC_ALL, "");
#ifdef _WIN32
+ arg_list_utf_16to8(argc, argv);
create_app_running_mutex();
-#endif
+#endif /* _WIN32 */
/*
* Get credential information for later use, and drop privileges
@@ -685,16 +700,6 @@ DIAG_ON(cast-qual)
QString cf_name;
unsigned int in_file_type = WTAP_TYPE_AUTO;
- // In Qt 5, C strings are treated always as UTF-8 when converted to
- // QStrings; in Qt 4, the codec must be set to make that happen
-#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
- // Hopefully we won't have to use QString::fromUtf8() in as many places.
- QTextCodec *utf8codec = QTextCodec::codecForName("UTF-8");
- QTextCodec::setCodecForCStrings(utf8codec);
- // XXX - QObject doesn't *have* a tr method in 5.0, as far as I can see...
- QTextCodec::setCodecForTr(utf8codec);
-#endif
-
/* Add it to the information to be reported on a crash. */
ws_add_crash_info("Wireshark %s\n"
"\n"