Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does a file on windows have an encoding attribute?

I have been reading about the issue with trying to figure out the actual encoding of a file and all its complications. But I just need to know what the encoding of a file was set to when it was saved. Does windows store this information somewhere similar to file type , date modified etc., ?

like image 492
unmaskableinterrupt Avatar asked Jul 01 '11 19:07

unmaskableinterrupt


People also ask

How can I tell what encoding a file is in Windows?

Open up your file using regular old vanilla Notepad that comes with Windows. It will show you the encoding of the file when you click "Save As...". Whatever the default-selected encoding is, that is what your current encoding is for the file.

How can I tell if a file is UTF 8 encoded?

Open the file in Notepad. Click 'Save As...'. In the 'Encoding:' combo box you will see the current file format. Yes, I opened the file in notepad and selected the UTF-8 format and saved it.

What is the encoding of a file?

An encoding standard is a numbering scheme that assigns each text character in a character set to a numeric value. A character set can include alphabetical characters, numbers, and other symbols.

How can I determine encoding of a text file?

Open the file with Notepad++ and will see on the right down corner the encoding table name. And in the menu encoding you can change the encoding table and save the file.


1 Answers

That's not available. The Windows file system (NTFS) doesn't store any metadata for a file beyond the trivial stuff like name, extension, last written date, etcetera. Nothing that's specific for the file type.

All you have available is the BOM, bytes at beginning of the file that indicate the UTF encoding and byte order. It only exists for files encoded in UTF and, unfortunately, is optional. The real troublemakers however are text files that were encoded with a particular 8-bit non-Unicode code page. Usually created by a legacy application. Nothing you can do for that but hope that the file wasn't created too far away from your machine so that the default system code page is a match.

like image 99
Hans Passant Avatar answered Nov 09 '22 21:11

Hans Passant