Change the default encoding for saving files with Notepad++
Asked Answered
R

5

61

That's it . I want to open all the files in once (to make replacements). But notepad++ opens them all in ANSI and I have to go through each file and change the encoding to UTF-8.

Recent answered 23/2, 2011 at 12:20 Comment(1)
Have you looked for any config files within its installation folder?Repercussion
D
76

In Notepad++ 5.9 there is an option in Settings -> Preferences -> New Document/Default Directory to automatically convert ANSI files to UTF-8 without BOM on open

Diffident answered 28/5, 2011 at 10:20 Comment(3)
Finally a working solutin, thanks a lot. PS: From v6.1 it is called Encoding• UTF-8 without BOM[x] Apply to opened ANSI filesShuddering
This isn't working as expected for me. When I open an ANSI file with this setting turned on, some characters don't convert correctly and I see a lot of 'x92', 'x94', etc black squares in place of certain characters. When I turn the setting off and open the same file, it remains in the ANSI encoding and properly displays: ’ and ” characters (single-quote and double-quote). Then I manually do: Encoding > Convert to UTF-8 and it converts correctly. Is there some subtlety here that is causing the conversion not to work when the setting is turned on?Handiness
This doesn't work for me in the sense that if I do: npp newfile.c (where npp is just running n++ executable) in terminal - n++ asks me if it should create the non-existing file, I click on yes, and it's opened... as ANSI. But if I just click on "new file" in n++, it opens as UTF-8.Sesquialtera
S
19

Settings -> Preferences -> New Document/Default Directory -> UTF-8

Sedda answered 23/2, 2011 at 12:25 Comment(3)
this works only for new documents.. but if you opened an existing document it will not affect itRecent
True that. If you're feeling adventurous, you could starting looking for the default encoding in the source and recompile it.Sedda
svn.tuxfamily.org/viewvc.cgi/notepadplus_repository/trunk/…Sedda
H
2

I believe you can change this in config.model.xml. I'm not sure if it is setting an unknown type as the default type, however, but it might be worth altering NewDocDefaultSettings

<GUIConfig name="NewDocDefaultSettings" format="0" encoding="0" lang="0" />

to

<GUIConfig name="NewDocDefaultSettings" format="0" encoding="4" lang="0" />

I think at worse case you might be able to record a Macro to automate this process.

Hauser answered 23/2, 2011 at 12:25 Comment(3)
Note that it should be renamed to (and overwrite) config.xml, the model file is just there as a starting point.Mona
Thanks, sorry I forgot to mention that!Hauser
The config.xml is actually found in %userprofile%\%appdata%\Notepad++. My entry looks like <GUIConfig name="NewDocDefaultSettings" format="0" encoding="4" lang="0" codepage="850" openAnsiAsUTF8="no" />Conventional
I
1

Late but for new Users,i had faced a similar problem

Step 1:
Settings -> Preferences -> New Document ->[Encodng] UTF-8 without BOM (check Apply to opened ANSI files)

but any how it hadn't solved mine , i searched out and found that its a bug!

Notepad++ v6.4.5 bug fixes:

  1. Fix a crash issue while there's missing tag in functionList.xml. Fix

  2. UTF-8 (w/o BOM) detection bug.

Step 2: That's all have an update to >= v6.4.5 and follow Step 1

Illbred answered 24/8, 2013 at 18:3 Comment(1)
True, step 1 alone did not work for me. Yet, just updated to V6.6.6 latest, Jun 2014 but still same issue. Even though I selected utf-8 without boom check opened ANSI files in settings-> preferences. Any thoughts? Thanks.Intercrop
G
-4

look here to change default UTF8 settings for notepad ( new text documents ) - http://answers.microsoft.com/en-us/windows/forum/windows_7-windows_programs/default-utf-8-encoding-for-new-notepad-documents/525f0ae7-121e-4eac-a6c2-cfe6b498712c

Glosseme answered 17/6, 2013 at 15:38 Comment(1)
-1. Question is about Notepad++. This answer is about Notepad.Tungstite

© 2022 - 2024 — McMap. All rights reserved.