Forum Discussion
Windows 10 1903) How to change Default Encoding UTF-8 to ANSI In Notepad?
Hello,
does anyone know if you can re-enable ANSI encoding by registry in the notepad, instead of the default UTF8 encoding, which is given since Windows 10 version 1903.
==================================================
Important!!!
It's suspected to be a bug in Windows and hasn't been fixed in four years, and the only alternative is to change the default editor to Notpad++ or change the encoding settings on save. Thanks, Microsoft.
- It's suspected to be a bug in Windows and hasn't been fixed in four years, and the only alternative is to change the default editor to Notpad++ or change the encoding settings on save. Thanks, Microsoft.
12 Replies
- abdelfattahIron Contributor
There is no bug here...if you changed that registry entry like cam_amoi said to, it will show you ANSI by default, and it is not lying to you. It still works too.
0 1 2 3 4 5 6 7 8 9 A B C D E F ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~
Larry6631 odairnetto WIWIO if you save the file as "ANSI" but then it says "UTF-8" when you open it later, it's because on American/Canadian/Western European machines, a text file with only those characters in it (above) will be completely identical whether you tell it "ANSI" or "UTF-8" - both Windows-1252 and UTF-8 treat them the same way. Capital letter A is "41" in both - 0x41 to Windows-1252, U+0041 for UTF-8. These also happen to be all of the characters you can type on an ANSI (correct usage here, unlike Windows) QWERTY keyboard without resorting to Alt codes.
The Long Version:
Newer versions of Windows are doing you a much bigger favor than you realize. Please see the following images to see what I mean.
- I typed all of the ASCII characters, as well as all "printing" Windows-1252 characters and saved as UTF-8 (default) on Windows 10 22H2
- I opened it on Windows Server 2019 (1809) as "ANSI" - the default - you'll see why in a second
- I re-opened the same file on the first Windows 10 22H2 machine - it defaulted to reading it as "ANSI" - yet none of the glyphs changed! It's identical to the first picture, even though the second picture on a different computer is also treating it as "ANSI"
Can you take a wild guess as to why that might be? This is enabled on the 22H2 machine:
If I do the reverse - paste the same characters into a text document on the Windows Server 2019 machine (codepage should be set to 1252, because it's US English) and save as "ANSI", then try and open them in Notepad on a newer Windows 10 (or 11) machine with UTF-8 support enabled...
Now those same glyphs are gone again.
It will happen in Notepad++ too - at least when sharing files between these two machines. It defaults to trying to read the file from the older machine as "ANSI" and the glyphs at the bottom still vanish. I have to manually tell it the file is Windows-1252 - because while "Windows-1252" is what the server means when it says "ANSI" it isn't what this desktop means when it says "ANSI".
Those same glyphs at the bottom will change dramatically if I switch between the other Windows-125x codepages as well.
Prior to Windows 10 1903, the fields Notepad showed you for character encodings were all entirely misleading to begin with. "Unicode" on Windows really meant "UTF-16 LE BOM", and "UTF-8" actually meant "UTF-8 with BOM". And at least those two (plus Unicode Big Endian) consistently meant the same thing no matter what your codepage was or your regional settings were.
"ANSI"? That really meant "whatever your system codepage is set to". Like I said earlier "ANSI" on this server means "Windows-1252" but "ANSI" on my desktop really means "UTF-8", and "ANSI" on a Czech user's machine might mean "Windows-1250", and "ANSI" in the Middle East might mean Windows-1255 or Windows-1256...or even Windows-1252, just because.
You have no idea how much headache that simple change to UTF-8 (with no BOM!) as the default in Notepad has saved if you deal with files from all around the world.
- WIWIOCopper ContributorIt's suspected to be a bug in Windows and hasn't been fixed in four years, and the only alternative is to change the default editor to Notpad++ or change the encoding settings on save. Thanks, Microsoft.
- cam_amoiCopper Contributor
- In Regedit go to Computer\HKEY_CURRENT_USER\Software\Microsoft\Notepad
- in the menu select edit/new/DWORD
- in the DWORD name enter iDefaultEncoding and enter value 1 as hexadecimal (it will automatically display as 0x0000001 (1) once you press OK)
[HKEY_CURRENT_USER\Software\Microsoft\Notepad]
"iDefaultEncoding"=dword:00000001
1 = ANSI ; 2 = UTF-16 LE ; 3 = UTF-16 BE ; 4 = UTF-8 BOM ; 5 = UTF-8
- buffelenCopper Contributor
Old post, i know, but
THANKS :-)
That fix one problem, but how to change from utf-8 to ansi in the type command? - frode66Copper Contributor
Very helpfull.
You should not by any chance have the value corresponding to "1252 Western Europe (Windows)" as well ?
- jflarvoireCopper Contributor
1 = ANSI is "1252 Western Europe (Windows)" on all Western Europe, USA, and Canada versions of Windows
- Hi,
there is an answer here:
https://answers.microsoft.com/en-us/windows/forum/windows_7-windows_programs/default-utf-8-encoding-for-new-notepad-documents/525f0ae7-121e-4eac-a6c2-cfe6b498712c
you can also use Notepad++
https://notepad-plus-plus.org/
that supports changing default encoding- WIWIOCopper Contributor