issue with notepad++ and iso-8859-1

4.2k Views Asked by At

I need to make two HTML files and I use notepad+++ to do it. These two files must be encoded in Latin-1 A.K.A iso-8859-1.

When I select that option. notepad++ displays iso 8859-1 at the bottom-right of the screen. But notepad++ does not considere, I need to save AND

when I close the tabs and reload the files, "ANSI" is displayed at the bottom right.

What should I do ?

1

There are 1 best solutions below

1
On BEST ANSWER

Many character sets have characters in common. Encodings for those character sets often encode common characters with the same bytes.

If all the characters in your file are in both ISO 8859-1 and whichever ANSI character set is your default then saving as either encoding could produce a file with the same bytes. If so, this is a coincidence you should ignore.

It is great that you have been given a explicit requirement for the encoding. Two people/systems cannot definitively exchange text without both knowing the encoding. However, few systems are designed to actually save this "metadata" with text files. Most rely on a user or operating system default encoding. Many programs like Notepad++ calculate which encodings the file would be valid for and would select the default when it is one of the candidates.

This is why document specifications like HTML or XML (which are intended to be passed between systems) allow the encoding to be specified inside the text. A program reading a file can guess at encodings until it can read the file well enough to see which is specified.

To tell if it doesn't matter in your case, save two copies: one as ISO 8859-1, the other as your ANSI encoding. Then open a command prompt and run fc /b latin.htm ansi.htm. It might print FC: no differences encountered. Again, this is a coincidence. When asked for text with an ISO 8859-1 encoding, save it that way and say that's what it is when you deliver it.

To make it clear, you could specify the encoding in the text. Do it per the standard your HTML document is: HTML 4.01 or HTML 5.