1

Every time I'm saving a file that has some Unicode characters in notepad, it prompts me that this file is going to be saved in ansi format and you will losing some data and I should cancel saving and choose UTF8 as unicode. How can I set default encoding to UTF8 so it will not prompt me every time? thanks in advance.

hamidreza75
  • 567
  • 6
  • 15

2 Answers2

1

In windows 10, get to
Control Panel > Region > Tab Administrative
Hit button "Change system".
Then choose the language you use from the combobox labeled "Current system locale".
And check the checkbox labeled "Beta: Use Unicode UTF-8 for worldwide language s".
Hit the ok button.

Shadyar
  • 709
  • 8
  • 16
  • 2
    This configures the entire system to use UTF-8 for both the OEM and ANSI codepages, which may break legacy (non-Unicode) applications. For example, legacy console applications use the console's current input and output codepages, which default to OEM. The console does not support UTF-8 as the input codepage, in which case it's limited to just reading ASCII input (ordinals 0-127). – Eryk Sun Aug 21 '20 at 22:20
  • Do you have any suggestion to not break these legacy applications and use unicode for other apps? – hamidreza75 Aug 23 '20 at 01:47
  • 1
    @hamidreza75, Notepad was [updated in Windows 10 1903](https://www.bleepingcomputer.com/news/microsoft/windows-10-notepad-is-getting-better-utf-8-encoding-support/) to default to saving files as UTF-8 (without a BOM). You can override the default by setting a DWORD value named "iDefaultEncoding" in the key "HKCU\Software\Microsoft\Notepad". The supported values are 0 (no default), 1 (ANSI), 2 (UTF-16 LE), 3 (UTF-16 BE), 4 (UTF-8 with BOM), 5 (UTF-8). – Eryk Sun Aug 23 '20 at 22:55
-1

Short answer - Notepad simply does not support what you are asking for. It will always default to ANSI, you have to tell it explicitly not to use ANSI. However, there are alternatives available, see Changing the default ANSI to UTF-8 in Notepad on SuperUser.

Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770