Default UTF-8 encoding for new Notepad documents

Short of using a third party editor, is there a way to configure Notepad so that new documents are automatically saved in Unicode without having to change manually the encoding every single time from default ANSI to UTF-8?

Typical scenario:

- Start typing some text with no extended characters
- Save the file: It is automatically in ANSI
- Open the file again to edit, add some extended characters, save again:
  Notepad tells you the extended characters will be lost if you confirm the save operation.

At least that last message offers the possibility to backup and "Save as" to choose UTF-8, but 1) this is very cumbersome, and 2) files with no extended characters will still be saved in ANSI by default.

Windows won't really be fully Unicode if the default Notepad encoding is still the obsolete ANSI code page, but, even if I reluctantly admit changing default behaviors is tricky for compatibility reasons, there should at least be a user option to select the default encoding for new documents, like other third party editors offer, such as Notepad++.

Currently, Windows forces me to replace Notepad file associations to use other text editors. Not a bad thing given the poor set of features in Notepad, but it would have been great to have this option in the standard O.S.

 

Question Info


Last updated October 16, 2018 Views 165,541 Applies to:
Answer

1. Right click -> New -> Text Document
2. Open "New Text Document.txt". Do NOT type anything!
3. Go to "File -> Save As... " and choose UTF-8 under "Encoding:", press "Save" and overwrite existing file. Close the file.
4. Rename "New Text Document.txt" to "TXTUTF-8.txt"
5. Copy "TXTUTF-8.txt" to "C:\WINDOWS\SHELLNEW"
6. Go to "Start -> Run..." and type
---------
regedit
---------
Press OK.
7. Navigate to
-------------------------------------------
HKEY_CLASSES_ROOT\.txt\ShellNew
-------------------------------------------
8. Right click in the right window -> New -> "String Value" and rename it to
-----------
FileName
-----------
9. Double click on "FileName" and put
----------------
TXTUTF-8.txt
----------------
into "Value data:" field and press OK.
10. It's finished.
11. Test it: Create new .txt document (Right click -> New -> Text Document). Open it and go to "File -> Save As... " and see that encoding is set by default to UTF-8 . :-)

Credits go to Robert Clemenzi and his explanation of "FileName" string (and its linkage with "Template directory") within registry:
http://mc-computing.com/WinExplorer/WinExplorerRegistry_ShellNew.htm

NOTE: These steps are ONLY for creating new and blank UTF-8 .txt documents. If .txt is already saved with ANSI encoding, it will stay ANSI when saving it next time - so if UTF-8 is needed (in this case), it must be set manually.

P.S. Also change "fSavePageSettings" & "fSaveWindowPositions" DWORD values to "1" within following registry key:

HKEY_CURRENT_USER\Software\Microsoft\Notepad

Info: http://www.pc1news.com/saving-changes-to-notepad-configuration-1216.html

169 people were helped by this reply

·

Did this solve your problem?

Sorry this didn't help.

Great! Thanks for marking this as the answer.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this response?

Thanks for your feedback.