aboutsummaryrefslogtreecommitdiffstats
path: root/wsutil/unicode-utils.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2018-10-07 19:04:50 -0700
committerGuy Harris <guy@alum.mit.edu>2018-10-08 03:05:45 +0000
commitbce13644e9d528a153f87019738a1582c9cae606 (patch)
tree4b662ab2fd3274da65c1fdc09a8995a436af798b /wsutil/unicode-utils.c
parent9388bd0436550e456fb0d9957a8328f1124c4800 (diff)
Bring back arg_list_utf_16to8(), but have it just do UTF-16-to-UTF-8 mapping.
Call it from wmain() in the command-line tools, passing it the input argument count and vector, and call it from main() in Wireshark, after getting a UTF-16 argument vector from passing the result of GetCommandLineW() to CommandLineToArgvW(). Change-Id: I0e51703c0a6c92f7892d196e700ab437bd702514 Reviewed-on: https://code.wireshark.org/review/30063 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'wsutil/unicode-utils.c')
-rw-r--r--wsutil/unicode-utils.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/wsutil/unicode-utils.c b/wsutil/unicode-utils.c
index 5a8fa2336a..46dbcadbda 100644
--- a/wsutil/unicode-utils.c
+++ b/wsutil/unicode-utils.c
@@ -141,6 +141,20 @@ utf_16to8(const wchar_t *utf16str)
return utf8buf[idx];
}
+
+/* Convert our argument list from UTF-16 to UTF-8. */
+char **
+arg_list_utf_16to8(int argc, wchar_t *wc_argv[]) {
+ char **argv;
+ int i;
+
+ argv = (char **) g_malloc(sizeof(char *) * argc);
+ for (i = 0; i < argc; i++) {
+ argv[i] = g_utf16_to_utf8(wc_argv[i], -1, NULL, NULL, NULL);
+ }
+ return argv;
+}
+
#endif
/*