Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am looking for a tool that for given directory will find all files having particular character encoding (like UTF-8). Do you know such a tool?

EDIT: OS - Windows XP

share|improve this question
There's no completely reliable way to detect any file's encoding in the first place. – Ignacio Vazquez-Abrams Nov 9 '10 at 15:01

In general this is not possible - apart from the special case of UTF-8 text files with a Byte Order Mark. Since the name of the encoding is not stored in the text file the only way to tell, for example, CP437 from CP850 would be to make a guess based on a statistical analysis of the whole file, looking at frequency of certain character pairs etc.

Solaris users have auto_ef but, so far as I know, there isn't a Windows port.

Perl users have Encode::Guess

According to Wikipedia "The newer versions of the unix File command attempt to do a basic detection of character encoding. (also available on cygwin and mac)"

None of the above will be 100% reliable. If your files are definitely all in one of a handful of known encodings you may be able to do better.

share|improve this answer

This tool works great. Check it out. It shows all files and their encodings for a folder.

There is also this, for bulk changing files to UTF8.

share|improve this answer

Under Windows this is possible by searching for the right Byte Order Mark (BOM), on the condition that the files were created with a BOM.

You would need a search program for that.
One possibility may be Grep for Windows and search using the beginning of file operator (^^).

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .