How can I see what the format of my textfile is?

1

I have a textfile and I want to know whether it is Ascii or UTF-8 or something else. How can I see this? Any tool or website that I can use?

Natrium

Posted 2010-12-29T08:15:08.443

Reputation: 438

4Unless the file contains a BOM there is no 100%-sure way of doing this. – Ignacio Vazquez-Abrams – 2010-12-29T09:03:18.323

@Ignacio Vazquez-Abrams I cannot recall ever opening a file in Notepad++ where something related to the encoding was not displayed in the bottom right hand corner of the screen, but maybe I have never run into a file without a BOM. Even if a file didn't contain a BOM, couldn't a person just open a file in Notepad++ as I suggested in my answer and select from the various encoding settings until one looked right? Then we would know the selected setting was the encoding of the file. – ubiquibacon – 2010-12-29T13:54:15.917

@typoknig: Assuming the person going through the various encodings has some idea of what it's supposed to look like, sure. But it is possible to fool people with some of the old DOS codepages. – Ignacio Vazquez-Abrams – 2010-12-29T14:17:41.213

Answers

1

$ file unicode.txt
unicode.txt: UTF-8 Unicode text

I expect the file utility is available for Windows as part of CygWin

I'm surprised it isn't included in UnxUtils or GNU CoreUtils for Windows

As Ignacio Vazquez-Abrams suggests, for many files, software tools can only make a guess based on sampling and probabilites.

RedGrittyBrick

Posted 2010-12-29T08:15:08.443

Reputation: 70 632

1

It was never a part of coreutils. http://gnuwin32.sourceforge.net/packages/file.htm

– Ignacio Vazquez-Abrams – 2010-12-29T12:11:51.710

1

Use Notepad ++. The information you are looking for is displayed in the bottom right hand corner of the screen.

ubiquibacon

Posted 2010-12-29T08:15:08.443

Reputation: 7 287