From 4dc3114c050ac2fb6da2b19103ce4995f6d91561 Mon Sep 17 00:00:00 2001 From: Gerald Combs Date: Wed, 24 Jun 2020 16:02:39 -0700 Subject: Windows: Set our locale to ".UTF-8". In each of our executables we were calling "setlocale(LC_ALL, "")" at startup. This told Windows that output was encoded using the current system code page. Unless the code page was 65001 (UTF-8), this was a lie. We write UTF-8 to stdout and stderr, so call "setlocale(LC_ALL, ".UTF-8)" at startup on Windows. This lets the CRT translate our output correctly in more cases. Clarify and expand the OUTPUT section in the tshark man page. Bug: 16649 Change-Id: If93231fe5b332c292946c7f8e5e813e2f543e799 Reviewed-on: https://code.wireshark.org/review/37560 Petri-Dish: Gerald Combs Tested-by: Petri Dish Buildbot Reviewed-by: Gerald Combs --- capinfos.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'capinfos.c') diff --git a/capinfos.c b/capinfos.c index 8e7e7b8455..719659a4a6 100644 --- a/capinfos.c +++ b/capinfos.c @@ -1551,8 +1551,15 @@ main(int argc, char *argv[]) gcry_md_hd_t hd = NULL; size_t hash_bytes; - /* Set the C-language locale to the native environment. */ + /* + * Set the C-language locale to the native environment and set the + * code page to UTF-8 on Windows. + */ +#ifdef _WIN32 + setlocale(LC_ALL, ".UTF-8"); +#else setlocale(LC_ALL, ""); +#endif cmdarg_err_init(failure_warning_message, failure_message_cont); -- cgit v1.2.3