Thursday, March 25, 2010

How to make UTF-8 as default encoding in Notepad++ manually

The following information applies to version 5.1 up to the current latest version 5.6.8. It may apply to the future versions. However, if you're using the latest one (5.6.8), the GUI now provides a nice setting for you to change (Settings -> Preferences -> New Document/Default Directory). If you use the GUI to change the settings, the following manual method may not work. I don't know where another configuration files are stored.

Important: Don't use the same version of Notepad++ to edit any its configuration files. Otherwise, all your changes or modifications will be lost when you exit.

Note that I use Notepad++ zip version and do the manual installation instead of using the executable installer. Thus, your installed file structure may be different from mine if you're using installer.

  • Go to the location where you install your Notepad++ and you should see two folders, ansi and unicode.

    Each folder represents a distinct version. The Unicode version is mainly to support Unicode characters in paths. Please see here to learn more about these two versions.
  • Go in either ANSI or Unicode version folder where you may use to launch your Notepad++.
  • Open the file called config.xml. For the newest version, this file doesn't exist at the beginning but config.model.xml is provided. Make a copy from config.model.xml and then rename it to config.xml.
  • Locate the following line:
    <GUIConfig name="NewDocDefaultSettings" format="0" encoding="1" lang="0" openAnsiAsUTF8="no" />
  • Set encoding to 4 for UTF-8. For other encodings, see the table below or the comment inside the file.
    <GUIConfig name="NewDocDefaultSettings" format="0" encoding="4" lang="0" openAnsiAsUTF8="no" />
    1UCS2 BIG
    3UTF 8
    4UTF 8 without BOM
  • Relaunch the Notepad++.