Closed odedshimon closed 3 years ago
Solution would be to set libpcap to utf-8 mode using pcap_init
@kayoub5 should we be doing that by default? There was another user with a similar issue, I think Chinese locale. I don't see us calling pcap_init() anywhere at the moment.
@kayoub5 should we be doing that by default? There was another user with a similar issue, I think Chinese locale. I don't see us calling pcap_init() anywhere at the moment.
I believe so, this ticket is easier to reproduce compared to #87 Please note that the call to pcap_init may fail old libpcap installations, since the method was added rather recently.
We don't call pcap_wsockinit either. This looks like new behavior, never heard that we needed to make such calls in the past. https://man7.org/linux/man-pages/man3/pcap_init.3pcap.html
@odedshimon could you try #303 and see if it fixes the problem for you, string encoding is a bit tricky and depends a lot on the framework, os and system encoding being used
Sure. I have tested it: cloned the repo, create an updated nuget and installed it (Windows 10, Net Core 3.1.4).
Seems that the file is still not recognized (appears as "????" although the string is "אבגדה"):
I have also tried the example project ("ReadingCaptureFile"), still same exception:
I have uploaded an example file (just change the extension to "pcap") אבגדה.txt
@odedshimon What path does ConfigureStringEncoding
take during initialization?
Pcap.Version
return?GetACP()
chcp
command@odedshimon screenshot indicates you are in master branch, encoding support is still in feature/pcap_encoding
branch
Sorry, I thought it was merged 😃
This indicates that the file name may have not been passed correctly to the application from the command line The code for this line is
Console.WriteLine("opening '{0}'", capFile);
Meaning that the file name encoding may have been screwed up even before it arrived to the CaptureFileReaderDevice
ConfigureStringEncoding - I'm not sure what to check, feel free to guide me.
There are 4 return statements, which one got executed, return Encoding.UTF8;
return Encoding.GetEncoding((int)GetACP());
or return Encoding.ASCII;
I have verified that the path is passed properly and it seems to work: Well done.
Hi!
I came across this exception when trying to read a file that contains non ASCII chars at his name:: Invalid argument"
The non ASCII chars are shown as question marks (picture attached) even though the file exists (the original file name is: "Non ASCII file name - (אבג).pcap").
"Unable to open offline adapter:
Thank you for the efforts invested in the development of this package!
Oded.