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" />
    
    0ANSI
    1UCS2 BIG
    2UCS2 SMALL
    3UTF 8
    4UTF 8 without BOM
  • Relaunch the Notepad++.

5 comments:

  1. how do i make it work in the latest version? i've chenged the setting to 3 and i have two identical files, one named config.xml and the other one config.model.xml

    ReplyDelete
  2. Check and see if you have another copy of "doLocalConf.xml" somewhere that causes notepad++ reading the wrong "config.xml".

    Usually there is one zero-length file called "doLocalConf.xml" in the same folder along with "notepad++.exe". The existence of this file tells notepad++ where to read the configuration files and settings.

    If you previously used installer to install notepad++, this file may also exist in %APPDATA%\Notepad++ folder. Remove the one you don't want.

    Make sure you don't run multiple versions of notepad++ at the same time. If so, the first set of XML files read by whatever versions of notepad++ always takes precedence. It means the first set of XML files read by notepad++ will be used.

    Hope that your issue will be resolved soon.

    ReplyDelete
  3. Thanks so much! I have been wrestling with UTF* reverting to ANSI for months!! No more thanks to article.

    ReplyDelete
  4. Work like a charm for me! I have the newest version v5.9.6.2. Thanks a lot.

    ReplyDelete
  5. here is a simple fix for that - http://www.softpedia.com/get/System/OS-Enhancements/Notepad-Default-UTF-8-Unicode-Creator.shtml

    ReplyDelete