Mime-Detective-clarkis117 icon indicating copy to clipboard operation
Mime-Detective-clarkis117 copied to clipboard

Csv detected as wav

Open 1100594 opened this issue 6 years ago • 2 comments

Hi,

Is csv supported? I've tried to detect a csv, but the file is detected as wav.

Thanks,

1100594 avatar Dec 12 '18 08:12 1100594

I have tried to detect a csv as well, but it couldn't detect any mime type at all. It was just a semicolon-separated csv file. Apart from that, nothing special about it.

brunoRyckaert avatar Feb 12 '19 18:02 brunoRyckaert

Duplicate of #30 ?

Can you show us the starting bytes of the file? In hex? To do that, you can use Visual Studio > Open file, select the file, Open with..., Binary editor.

This is not really documented here but I have to say that detecting text files is an almost impossible task. Complex files (zip, png, mp3...) often use distinguishable bytes at the beginning of the file. Text files and random files don't. So we cannot detect them objectively. And if you add the issue of detecting the encoding, then the task gets event harder.

I recommend using multiple mechanisms for your task. First use MimeDetective to detect a known file type. If it returns null, then the file may be a text file. Use other mechanisms to detect specific files (CSV, XML...).

Does that help you?

sandrock avatar May 05 '19 09:05 sandrock