In Windows 10/11 when you create new text documents, either from right mouse button menu New or from Notepad, by default they are encoded with UTF-8 (and in Windows 7 it is ANSI).
While there is no obvious way to change the default encoding of a new text files to a desired one, it is still possible to change it.
In this guide I will focus on changing the default encoding to Unicode (aka UTF-16 LE and UTF-16 LE BOM) but you can choose another one to your liking.
1. Change the default encoding of new text documents created from the context menu "Right Mouse Click > New > Text Document".
1) Create a new text file, open it in any text editor and save this empty file with Unicode encoding:
○ Unicode or UTF-16 LE (Windows Notepad)
○ UTF-16 LE BOM (Notepad++)
○ UCS-2 Little Endian (other editors)
2) Rename the file to TXTUNICODE.txt and place it in C:\Windows\ShellNew (if you don't have ShellNew folder then create one)
(.txt is an extension and not a part of the name, do not make it TXTUNICODE.txt.txt).
3) Open regedit.exe
–> go to HKEY_CLASSES_ROOT\.txt\ShellNew
–> Create new String Value
–> call it FileName
–> double click it to modify
-> in the "Value Data" field type TXTUNICODE.txt
The change applies instantly.
2. Change the default encoding of new text files created in Notepad.
1) Open regedit.exe > go to HKEY_CURRENT_USER\Software\Microsoft\Notepad
2) Right click in the directory and choose New -> DWORD (32-bit) Value, call this new value as iDefaultEncoding and double click it to modify it.
3) In the Value Data field type one of the numbers which represent encoding:
1 – ANSI
2 – UTF-16 LE
3 – UTF-16 BE
4 – UTF-8 with BOM
5 – UTF-8
in my case I choose 2.
The change applies instantly.
3. Change the default encoding of new text documents created in Notepad++.
This is fairly easy and is done right from Notepad++ as well as other modern text editors. This is where it can be changed in Notepad++:
1) Open Notepad++ and go to Settings > Preferences
2) From the list of preferences select "New Document" and choose "UTF-16 Little Endian with BOM"
It is currently September 14th, 2024, 5:58 pm
Change default encoding for new text files in Windows
-
- Moderator
- Posts: 1307
- Joined: February 16th, 2012, 3:32 am
- Location: Berlin, Germany
Change default encoding for new text files in Windows
You do not have the required permissions to view the files attached to this post.
-
- Posts: 523
- Joined: May 4th, 2020, 3:01 pm
- Location: Ankara, TURKEY
Re: Change default encoding for new text files in Windows
I'm sorry but I don't have "UTF-16 Little Endian wtih Bom" on hand.
What should I do?
You do not have the required permissions to view the files attached to this post.
I don't know where i going from here, but i promise it won't be boring...
-
- Rainmeter Sage
- Posts: 5510
- Joined: April 12th, 2012, 9:40 pm
- Location: Cedar Point, Ohio, USA
Re: Change default encoding for new text files in Windows
My version 8.4.4 (64-bit) of Notepad++ shows UTF-16 "Little" Endian with BOM... Not sure why you have "Small" instead of "Little" in your screenshot?! Perhaps someone used a 'Replace All' command and changed "Little" to "Small"?
I would download and install a fresh copy of Notepad++
You do not have the required permissions to view the files attached to this post.
:: My DA Gallery :: Rainmeter DA Gallery :: Rainmeter Workshops :: Rainmeter Documentation :: BBCode Guide ::
-
- Posts: 523
- Joined: May 4th, 2020, 3:01 pm
- Location: Ankara, TURKEY
Re: Change default encoding for new text files in Windows
eclectic-tech wrote: ↑August 12th, 2022, 1:57 am My version 8.4.4 (64-bit) of Notepad++ shows UTF-16 "Little" Endian with BOM...
Screenshot 2022-08-11 215056.png
Not sure why you have "Small" instead of "Little" in your screenshot?! Perhaps someone used a 'Replace All' command and changed "Little" to "Small"?
I would download and install a fresh copy of Notepad++
I changed the language to English.
You're right, translation error...
You do not have the required permissions to view the files attached to this post.
I don't know where i going from here, but i promise it won't be boring...
-
- Rainmeter Sage
- Posts: 8126
- Joined: February 27th, 2015, 2:38 pm
- Location: Terra Yincognita
Re: Change default encoding for new text files in Windows
Well, I could have told you that this was the right checkbox, even without knowing what the words meant. In the English version, there are only 2 UTF-16, both "with" BOM. Similarly, in your screenshot, you had 2 UTF-16 (one very big, one very small, "BOM chicka bom" going boom), and both ended up in "ile", witch was obviously the equivalent for "with" (and Google Translate, although not needed here, agrees).
Sometimes intuition is enough, not always needing to know the language. After all, that's how most people learn programming languages, when they lack other more substantial sources...
P.S. I joked a bit above, hope you don't mind - the little things (like encoding) can cause the biggest trouble, if one doesn't know what to expect. When the person finds the solution and understands the context, he usually wonders how he wasn't able to overcome such minor details. I use the same setting in Notepad++, by the way, although I also began by manually converting every little INI before realizing I could have set it as default.
-
- Posts: 523
- Joined: May 4th, 2020, 3:01 pm
- Location: Ankara, TURKEY
Re: Change default encoding for new text files in Windows
Yincognito wrote: ↑August 30th, 2022, 2:26 am Well, I could have told you that this was the right checkbox, even without knowing what the words meant. In the English version, there are only 2 UTF-16, both "with" BOM. Similarly, in your screenshot, you had 2 UTF-16 (one very big, one very small, "BOM chicka bom" going boom), and both ended up in "ile", witch was obviously the equivalent for "with" (and Google Translate, although not needed here, agrees).
Sometimes intuition is enough, not always needing to know the language. After all, that's how most people learn programming languages, when they lack other more substantial sources...
P.S. I joked a bit above, hope you don't mind - the little things (like encoding) can cause the biggest trouble, if one doesn't know what to expect. When the person finds the solution and understands the context, he usually wonders how he wasn't able to overcome such minor details. I use the same setting in Notepad++, by the way, although I also began by manually converting every little INI before realizing I could have set it as default.
Of course it's okay
From the outside it looks pretty ridiculous but when you do not know how many formats UTF has, one inevitably falls into hesitation.
Otherwise, it had already occurred to me, but I thought I'd ask anyway
I don't know where i going from here, but i promise it won't be boring...
-
- Rainmeter Sage
- Posts: 8126
- Joined: February 27th, 2015, 2:38 pm
- Location: Terra Yincognita
Re: Change default encoding for new text files in Windows
Not really ridiculous since we've all been through moments like that on various occasions, but funny because it reminds me of my own such moments. For example, on a couple of occasions I spent hours or days being absolutely mad that I couldn't fix something in my skins / code, and in the end it turned out to be a single "+" that had to be turned into "-", or some trivial bang that automagically solved the whole thing.
So yeah, it's no problem asking. I'm just saying that later on you'll find such instances amusing, just like I do, because looking in perspective the solution is not as hard or out of reach as you originally thought it would be.
-
- Posts: 523
- Joined: May 4th, 2020, 3:01 pm
- Location: Ankara, TURKEY
Re: Change default encoding for new text files in Windows
DefinitelyYincognito wrote: ↑August 30th, 2022, 12:11 pm Not really ridiculous since we've all been through moments like that on various occasions, but funny because it reminds me of my own such moments. For example, on a couple of occasions I spent hours or days being absolutely mad that I couldn't fix something in my skins / code, and in the end it turned out to be a single "+" that had to be turned into "-", or some trivial bang that automagically solved the whole thing.
So yeah, it's no problem asking. I'm just saying that later on you'll find such instances amusing, just like I do, because looking in perspective the solution is not as hard or out of reach as you originally thought it would be.
I don't know where i going from here, but i promise it won't be boring...