title: Finding the encoding of text files
body: <p>I have a bunch of text files with different encodings. But I want to convert all of the into utf-8. since there are about 1000 files, I cant do it manually. I know that there are some commands in llinux which change the encodings of files from one encoding into another one. but my question is how to automatically detect the current encoding of a file? Clearly I'm looking for a command (say FindEncoding($File) ) to do this:</p>
  
  <pre><code>foreach file
  do
  $encoding=FindEncoding($File);
  uconv -f $encoding -t utf-8 $file;
  done
  </code></pre>