This is a static archive of our old Q&A Site. Please post any new questions and answers at ask.wireshark.org.

command of tshark can not support Chinese path or Chinese file name

0

tshark` fails if its parameters contain Chinese characters (in a path parameter). For example:

tshark -r d:\中文.pcap -V -T text > d:\1.txt

wireshark 1.5.1 has solved the problem. but how to correct the source code if i just want to use wireshark1.2.9 ? which code of wireshark1.2.9 should be modified in order to solve the problem.

Thanks.

asked 15 Sep '11, 19:20

ylda_ljm0620's gravatar image

ylda_ljm0620
31101013
accept rate: 0%

edited 15 Sep '11, 23:49


One Answer:

1

CommandLineToArgvW requires shell32.lib. You probably just need to make this change to Makefile.nmake. In fact, you may want to apply all the changes committed in r35411.

answered 16 Sep '11, 14:14

cmaynard's gravatar image

cmaynard ♦♦
9.4k1038142
accept rate: 20%

edited 16 Sep '11, 14:17

to solve the problem, i modified in tshark.c of wireshark1.2.9 as follow:

int
main(int argc, char *argv[])
{
  char                *init_progfile_dir_error;
  int                  opt, i;
  extern char         *optarg;
  gboolean             arg_error = FALSE;

#ifdef _WIN32 WSADATA wsaData; LPWSTR wc_argv; int wc_argc,j; #endif / _WIN32 */

static const char optstring[] = OPTSTRING_INIT OPTSTRING_WIN32;

#ifdef _WIN32 /* Convert our arg list to UTF-8. */ wc_argv = CommandLineToArgvW(GetCommandLineW(), &wc_argc); if (wc_argv && wc_argc == argc) { for (j = 0; j < argc; j++) { argv[j] = g_utf16_to_utf8(wc_argv[j], -1, NULL, NULL, NULL); } } /* XXX else bail because something is horribly, horribly wrong? */ #endif /* _WIN32 */

but i can not compile successfully. the error :

tshark.c
tshark.c(772) : error C2220: warning treated as error - no 'object' file generat
ed
tshark.c(772) : warning C4013: 'CommandLineToArgvW' undefined; assuming extern r
eturning int
tshark.c(772) : warning C4047: '=' : 'LPWSTR *' differs in levels of indirection
from 'int'
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN
\cl.EXE"' : return code '0x2'
Stop.

how should i modify the thark.c?

(16 Sep ‘11, 02:10) ylda_ljm0620

thanks. It success.

i add shell32.lib to tshark_LIBS in Makefile.nmake, add #include <shellapi.h> in tshark.c.

(18 Sep ‘11, 20:19) ylda_ljm0620