Determine File Encoding
I ran into a problem where I wasn’t sure if I could trust the encoding that my text editor was displaying. I also wanted to check the encoding on about 10,000 files and determine if it was not a specific encoding. So, I created a little program to tell me the encoding of a file. This in combination with powershell allowed me to loop recursively through all the files in a directory and create a list of the files that were not the correct encoding.
A Good portion of the code that I used for this application was available on the another site that describes how to determine the Encoding of a Unicode file.
The application can be downloaded below:
![[Ask]](http://brett.batie.com/wp-content/plugins/bookmarkify/ask.png)
![[del.icio.us]](http://brett.batie.com/wp-content/plugins/bookmarkify/delicious.png)
![[Digg]](http://brett.batie.com/wp-content/plugins/bookmarkify/digg.png)
![[Facebook]](http://brett.batie.com/wp-content/plugins/bookmarkify/facebook.png)
![[Google]](http://brett.batie.com/wp-content/plugins/bookmarkify/google.png)
![[LinkedIn]](http://brett.batie.com/wp-content/plugins/bookmarkify/linkedin.png)
![[MySpace]](http://brett.batie.com/wp-content/plugins/bookmarkify/myspace.png)
![[Reddit]](http://brett.batie.com/wp-content/plugins/bookmarkify/reddit.png)
![[Slashdot]](http://brett.batie.com/wp-content/plugins/bookmarkify/slashdot.png)
![[Sphere]](http://brett.batie.com/wp-content/plugins/bookmarkify/sphere.png)
![[StumbleUpon]](http://brett.batie.com/wp-content/plugins/bookmarkify/stumbleupon.png)
![[Technorati]](http://brett.batie.com/wp-content/plugins/bookmarkify/technorati.png)
![[Twitter]](http://brett.batie.com/wp-content/plugins/bookmarkify/twitter.png)
![[Windows Live]](http://brett.batie.com/wp-content/plugins/bookmarkify/windowslive.png)
![[Yahoo!]](http://brett.batie.com/wp-content/plugins/bookmarkify/yahoo.png)
![[Email]](http://brett.batie.com/wp-content/plugins/bookmarkify/email.png)

September 8th, 2008 at 5:25 am
Hello,
What exactly this exe should do? I’m looking for exactly the same kind of program, but I didn’t notice anything, when I ran your program.
I’d appreciate, if you could give me more advice…
February 19th, 2009 at 6:22 pm
It is a command line program. To run it you open up dos by going to start→run and type cmd.
Then you run the program by giving it a file to process.
c:\path\to\FileType.exe c:\path\to\myfile.txt
May 15th, 2009 at 4:49 am
Hi.
Been looking for something like this but was wondering. No matter what the encoding is it only seems to return:
C:\Temp\Perl>FileType.exe expected_chinese.txt
1252: Western European (Windows)
I was expecting UTF-8.
David.