ANSI encoding is a slightly generic term used to refer to the standard code page on a system, usually Windows. It is more properly referred to as Windows-1252 on Western/U.S. systems. (It can represent certain other Windows code pages on other systems.) This is essentially an extension of the ASCII character set in that it includes all the ASCII characters with an additional 128 character codes. This difference is due to the fact that "ANSI" encoding is 8-bit rather than 7-bit as ASCII is (ASCII is almost always encoded nowadays as 8-bit bytes with the MSB set to 0). See the article for an explanation of why this encoding is usually referred to as ANSI.
The name "ANSI" is a misnomer, since it doesn't correspond to any actual ANSI standard, but the name has stuck. ANSI is not the same as UTF-8.
Answer from Noldorin on Stack OverflowANSI encoding is a slightly generic term used to refer to the standard code page on a system, usually Windows. It is more properly referred to as Windows-1252 on Western/U.S. systems. (It can represent certain other Windows code pages on other systems.) This is essentially an extension of the ASCII character set in that it includes all the ASCII characters with an additional 128 character codes. This difference is due to the fact that "ANSI" encoding is 8-bit rather than 7-bit as ASCII is (ASCII is almost always encoded nowadays as 8-bit bytes with the MSB set to 0). See the article for an explanation of why this encoding is usually referred to as ANSI.
The name "ANSI" is a misnomer, since it doesn't correspond to any actual ANSI standard, but the name has stuck. ANSI is not the same as UTF-8.
Technically, ANSI should be the same as US-ASCII. It refers to the ANSI X3.4 standard, which is simply the ANSI organisation's ratified version of ASCII. Use of the top-bit-set characters is not defined in ASCII/ANSI as it is a 7-bit character set.
However years of misuse of the term by the DOS and subsequently Windows community has left its practical meaning as “the system codepage of whatever machine is being used”. The system codepage is also sometimes known as ‘mbcs’, since on East Asian systems that can be a multiple-byte-per-character encoding. Some code pages can even use top-bit-clear bytes as trailing bytes in a multibyte sequence, so it's not even strict compatible with plain ASCII... but even then, it's still called “ANSI”.
On US and Western European default settings, “ANSI” maps to Windows code page 1252. This is not the same as ISO-8859-1 (although it is quite similar). On other machines it could be anything else at all. This makes “ANSI” utterly useless as an external encoding identifier.
How to convert .txt to ANSI encoding
ENCODING PROBLEM- Reading an ANSI File
Need help converting special characters to ANSI.
Encoding, Character Sets, and Culture are the Devil
You can force the Default encoding type, that GC uses. Then, it works fine through the streamreader.
$Default = [System.Text.Encoding]::Default $File = "Path\File.txt" $streamReader = New-Object System.IO.StreamReader($File, $Default) $StreamReader.ReadLine()More on reddit.com
You can use any character-set and any encoding to create a file and to view it.
You just have to be sure, when viewing, to use the same set and encoding as was used to write the file.
Most character sets actually have a large overlap. For example, most character sets (excluding EBCDIC and others) have the ASCII character set at the same positions (i.e. with same code-points) as ASCII. Therefore you could write a file in the Unicode character set with UTF-8 encoding and, so long as the file contained only characters that are in ASCII, you could view that file using a Windows Latin-1 encoding.
Note: Microsoft are very sloppy with terms such as "ANSI" and "Unicode".
Update:
Firstly, you should pay attention to Jukka's Answer as Jukka is an expert in this subject.
As for your Á, see this extract from here
Dec Hex ASC PC 437 850 Win Lat1 Uni
192 00C0 └ └ └ À À À
193 00C1 ┴ ┴ ┴ Á Á Á
194 00C2 ┬ ┬ ┬ Â Â Â
195 00C3 ├ ├ ├ Ã Ã Ã
196 00C4 ─ ─ ─ Ä Ä Ä
197 00C5 ┼ ┼ ┼ Å Å Å
Note that Á is at code point 194 (0xC1) in Windows Latin-1, in ISO 8859-1 Latin 1 and in Unicode / ISO 10646. If you wrote Á in Windows Latin-1 you could view it as ISO 8859-1.
You would have problems if you tried to read it as Unicode as Unicode encodings use multiple bytes to represent that character,
# echo $LANG
en_US.UTF-8
# cat t
TEST Á
# hexdump -C t
00000000 54 45 53 54 20 c3 81 0a |TEST ...|
00000008
Note that Á (Unicode code point 00C1) is encoded in UTF-8 as c3 81
The default encoding in Notepad++ is called “ANSI”, without clarification; it may mean windows-1252, or it may mean whatever 8-bit encoding is the system’s native 8-bit encoding (in your case, it’s probably windows-1252 anyway). “ANSI” is a Microsoft misnomer for its 8-bit encodings, one of which (now known as windows-1252) was long ago submitted to the American National Standards Institute for approval – and rejected.
There is no problem in entering “Á” in windows-1252 encoding. Naturally, Notepad++ also displays it OK. So do many, many other programs.
You would need UTF-8 if you wanted to enter “Ć” for example. Many people use UTF-8 even if they don’t need characters outside windows-1252 right now, to avoid any need to change the encoding later, if new characters are added.