Default UTF-8 encoding for new Notepad documents

Anonymous
2010-04-27T22:42:11+00:00

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.

Windows for home | Previous Windows versions | Apps

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments
Answer accepted by question author
Anonymous
2010-05-12T01:50:00+00:00
  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.

  1. Navigate to

HKEY_CLASSES_ROOT.txt\ShellNew


  1. Right click in the right window -> New -> "String Value" and rename it to

FileName


  1. Double click on "FileName" and put

TXTUTF-8.txt


into "Value data:" field and press OK.

  1. It's finished.
  2. 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

Was this answer helpful?

200+ people found this answer helpful.
0 comments No comments

48 additional answers

Sort by: Most helpful
  1. Anonymous
    2014-08-31T21:39:36+00:00

    Is this only meant to work if you go through the right click -> New Text File approach to a new .txt file? I often launch notepad by typing in search "Notepad" and hitting enter, or clicking on Notepad listed on the Start Menu (Screen - Win 8.1). But that defaults to ANSI.

    To clarify, your method works if I right click in Windows Explorer or my Desktop to create a .txt file.

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2014-06-17T03:17:12+00:00

    Hi Maneuver,

    Good advise.

    It works, but not completely ...

    It works if you create your txt file by a right-click-->new-->text file

    But if you create the new file directly by clicking on >Notepad in the start menu, it still creates an ANSI file.

    I think this is one of the small-but-big mistakes done by Microsoft in developping Windows, together with the terrible Japanese IME which by default is always writing in roman letters ...

    Windows should correct this at native level, I mean Notepad should be in UTF-8 by default from the beginning, like Japanese IME should be by default in Hiragana from the beginning... Do Microsoft understand what "Voice of the Customer" mean ?

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2013-12-18T18:07:12+00:00
    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.

    1. Navigate to

    HKEY_CLASSES_ROOT.txt\ShellNew


    1. Right click in the right window -> New -> "String Value" and rename it to

    FileName


    1. Double click on "FileName" and put

    TXTUTF-8.txt


    into "Value data:" field and press OK.

    1. It's finished.
    2. 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

    The PC1News.com link mentioned by Maneuver has moved here as of 18 Dec 2013 (found by clicking the link & placing "saving-changes-to-notepad-configuration", which was extracted from the original url, in the search box).

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2013-11-02T13:11:13+00:00

    I am running Windows 7 Ultimate 64-bit edition, and found that these outlined steps worked "as advertized." This is typical Microsoft incompetence that users have to go through this rigamarole to rectify obsolete encoding default, which users that have more than the English language at their command encounter EVERY TIME they attempt to save a file where "non-standard" characters are used (not to mention English-only users that insert special symbols not language-based in their plain text documents¹). Sometimes you see entire documents rendered unintelligible gibberish because the user didn't know to switch from ANSI to Unicode. Microsoft Windows "assumes" that the majority of computer users in the world are English-only speakers, and I don't know which it serves to illustrate more, their stupidity or their ethnocentrism. As an American "trotting about the globe" since a wee tyke, I find it inconvenient, not to mention offensive. This isn't 1974, when networking was in its infancy, or 1984, when I first started studying computers.

    Some people would suggest using applications that support HTML or XML or "enriched" text, and I would say that I do, but not for every document (sometimes they take too long to toad); I don't need blinking text, watermarks, pictures, and colors for notes.

    ¹Like subscripts and superscripts and bullets…just TRY saving chemical and mathematical formulae or complex and detailed outlines in ANSI!

    Was this answer helpful?

    0 comments No comments