0

I'm using the file command to detect mime type and text encoding, and it's working great in general.

But one situation it doesn't work so great for is with a HTML file. It's returning us-ascii, but if I serve the file over HTML with the HTTP content-type header set to ASCII, then JS which expects the page to be rendered with UTF-8 might not work. Even though the file has a <meta charset> header, file doesn't seem to be acknowledging it.

I could just parse/search HTML files for <meta charset> headers, but there could be some other file format that also has a header specifying a charset, and it would be nice in my app to not need to add a lot of special cases. So I was wondering if there was any program that is like file but just a little bit smarter so that it also parses file headers and doesn't just consider the files as if they were plain text?

0

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.