Forum Discussion
Notepad Default encoding UTF8 Windows 10 Version 1903
"Of course, there's no need to worry about UTF-8 vs. ANSI in the first place if every file contains only ASCII text."
Wrong. If you write for example "è" in notepad, when you open the file with another text editor, you will see "è" and not "è". Then, there's need to worry about UTF-8 vs ANSI, because "è" has his ASCII code, i.e. 232
It's not quite so easy!
Many people use Notepad for a quick .cmd/.bat file. These will not run under the command interpreter if encoded as UTF-8. The command interpreter simply gives a non-printable character plus the first character of the .cmd/.bat file and "is not recognized as a command" error if run from command prompt. If run as standalone, the window simply blinks open and closes immediately and does not execute the desired commands.
Anyone wanting to write a .cmd or .bat now needs to remember to save as ANSI - very inconvenient!
It would be very nice to have access to a key (maybe under HKCU\Software\Microsoft\Notepad) that respected the user's wishes for default coding. Or maybe Notepad could offer to set the coding as default?
- Dave29Aug 09, 2023Copper ContributorOn Windows 11 a .BAT file saved as UTF-8, the default, worked fine for me.
- abbodi1406Dec 04, 2019Iron Contributor
Windows Registry Editor Version 5.00 [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
- Serge_FraguasNov 28, 2023Copper ContributorUnderrated answer. Works like a charm! Thanks!
- ArmstchiDec 08, 2020Copper Contributoroh god. This works. It saved me. Thanks you.