Currently I’m running Windows 7 x64 and usually I want all console tools to work with UTF-8 rather than with default code page 850.
Running chcp 65001
in the command prompt prior to use of any tools helps but is there any way to set is as default code page?
Update:
Changing HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlNlsCodePageOEMCP
value to 65001
appear to make the system unable to boot in my case.
Proposed change of HKEY_LOCAL_MACHINESoftwareMicrosoftCommand ProcessorAutorun
to @chcp 65001>nul
served just well for my purpose. (thanks to Ole_Brun)
asked Apr 12, 2011 at 10:42
7
To change the codepage for the console only, do the following:
- Start -> Run -> regedit
- Go to
[HKEY_LOCAL_MACHINESoftwareMicrosoftCommand ProcessorAutorun]
- Change the value to
@chcp 65001>nul
If Autorun
is not present, you can add a New String
Nabi K.A.Z.
3801 gold badge5 silver badges10 bronze badges
answered Apr 12, 2011 at 12:22
Nils Magne LundeNils Magne Lunde
2,5421 gold badge16 silver badges14 bronze badges
11
Personally, I don’t like changing the registry. This can cause a lot of problems. I created a batch file:
@ECHO OFF
REM change CHCP to UTF-8
CHCP 65001
CLS
I saved at C:WindowsSystem32
as switch.bat
and created a link for cmd.exe
on the Desktop.
In the properties of the cmd shortcut, changed the destination to: C:WindowsSystem32cmd.exe /k switch
Voilà, when I need to type in UTF-8, I use this link.
answered Dec 7, 2013 at 15:36
jucajuca
6095 silver badges2 bronze badges
5
In the 1809 build of Windows 10 I’ve managed to permanently solve this by going to the system’s Language settings
, selecting Administrative language settings
, clicking Change system locale...
and checking the Beta: Use Unicode UTF-8 for worldwide language support
box and then restarting my pc.
This way it applies to all applications, even those ones that I don’t start from a command prompt!
(Which was necessary for me, since I was trying to edit Agda code from Atom.)
Bob Stein
1,3371 gold badge16 silver badges23 bronze badges
answered May 11, 2019 at 14:44
Isti115Isti115
88410 silver badges11 bronze badges
7
Edit the Registry:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlNlsCodePage]
"OEMCP"="65001"
Then restart. With this fix, if you are using Consolas font, it seems to lock
PowerShell into a small font size. cmd.exe
still works fine. As a workaround,
you can use Lucida Console, or I switched to Cascadia Mono:
https://github.com/microsoft/cascadia-code
answered Jun 13, 2015 at 20:39
1
This can be done by creating a PowerShell profile and adding the command «chcp 65001 >$null» to it:
PS> Set-ExecutionPolicy RemoteSigned
PS> New-Item -Path $Profile -ItemType file -Force
PS> notepad $Profile
This doesn’t require editing the registry and, unlike editing a shortcut, will work if PowerShell is started in a specific folder using the Windows Explorer context menu.
answered Sep 3, 2017 at 20:56
0
The command to change the codepage is chcp <codepage>
. Example: chcp 1252
. You should type it in a Powershell window.
To avoid the hassle of typing it everytime (if you always have to change the codepage), you may append it to the program’s command line. To do so, follow these steps:
- Right-click the Powershell icon on Start menu and choose «More» > «Open file Location».
- Right-click the Powershell shortcut and select «Properties».
- Add the following to the end of the «Target» command line:
-NoExit -Command "chcp 1252"
Be happy.
Don’t fuss with Windows Registry unless you have no other option.
answered Nov 2, 2016 at 21:11
JColaresJColares
591 silver badge1 bronze badge
1
Open in Powershell through Explorer still didn’t work for me even though I’ve tried enabling that Beta Unicode feature in the language settings.
However, I’ve just found this worked.
[HKEY_CURRENT_USERConsole%SystemRoot%_System32_WindowsPowerShell_v1.0_powershell.exe]
"CodePage"=dword:0000fde9
From: https://www.zhihu.com/question/54724102
answered Feb 15, 2021 at 11:09
If you’re using ConEmu then:
- Open up Settings from the upper right menu
- Go to Startup -> Environment
- Add
chcp 65001
on a new line. - Click «Save Settings».
- Close ConEmu and re-open it
answered May 4, 2020 at 1:22
Instead of changing the registry, you can instead create %HOMEPATH%init.cmd
.
Mine reads:
@ECHO OFF
CHCP 65001 > nul
answered Jan 21 at 9:39
View the System Locale settings for Windows
- Click Start then Control Panel.
- Click Clock, Language and Region.
- Windows 10, Windows 8: Click Region. …
- Click the Administrative tab. …
- Under the Language for non-Unicode programs section, click Change system locale and select the desired language.
- Click OK.
How do I change my default encoding?
2 Answers
- For Eclipse, default encoding for new files can be set from Windows > Preferences > General > Content Types (see post on Eclipse Community Forms)
- For Notepad++, navigate to Settings > Preferences > New Document/Default/Directory and set Encoding to UTF-8.
What is the default encoding in Windows 10?
The default character encoding is assumed to be UTF-8 on Windows. So if the default operating system Locale is “English_USA. 1252” the default locale for Boost.
How do you change Windows default encoding to UTF-8?
Open Windows Control Panel -> Region. Go to the Administrative tab and click Change system locale… Remove the check mark next to Beta: Use UTF-8 for worldwide language support. Click OK and restart your computer.
Does Windows 10 use UTF8?
Starting in Windows 10 build 17134 (April 2018 Update), the Universal C Runtime supports using a UTF-8 code page. This means that char strings passed to C runtime functions will expect strings in the UTF-8 encoding. … For Windows 10 operating systems prior to 17134, only static linking is supported.
How do I change file encoding in Windows?
Choose an encoding standard when you open a file
- Click the File tab.
- Click Options.
- Click Advanced.
- Scroll to the General section, and then select the Confirm file format conversion on open check box. …
- Close and then reopen the file.
- In the Convert File dialog box, select Encoded Text.
What is the default encoding for notepad?
Notepad normally uses ANSI encoding, so if it reads the file as UTF-8 then it has to guess the encoding based on the data in the file. If you save a file as UTF-8, Notepad will put the BOM (byte order mark) EF BB BF at the beginning of the file.
How do I change the default encoding to UTF-8 in Excel?
Click Tools, then select Web options. Go to the Encoding tab. In the dropdown for Save this document as: choose Unicode (UTF-8). Click Ok.
Why do we use UTF-8 encoding?
Why use UTF-8? An HTML page can only be in one encoding. You cannot encode different parts of a document in different encodings. A Unicode-based encoding such as UTF-8 can support many languages and can accommodate pages and forms in any mixture of those languages.
What is difference between UTF-8 and utf16?
The Difference
Utf-8 and utf-16 both handle the same Unicode characters. They are both variable length encodings that require up to 32 bits per character. The difference is that Utf-8 encodes the common characters including English and numbers using 8-bits. Utf-16 uses at least 16-bits for every character.
What is the default encoding for Excel?
From memory, Excel uses the machine-specific ANSI encoding. So this would be Windows-1252 for a EN-US installation, 1251 for Russian, etc.
How do I change the default encoding in Notepad ++?
go to the notepad++ menu settings > preferences > misc. and disable autodetect character encoding as seen at the screenshot below. then go to settings > preferences > new document and set encoding to your prefered encoding.
How do I change ANSI TO UTF-8?
Try Settings -> Preferences -> New document -> Encoding -> choose UTF-8 without BOM, and check Apply to opened ANSI files . That way all the opened ANSI files will be treated as UTF-8 without BOM.
How do I change my Windows locale?
System Locale
- Select Start > Control Panel > Clock, Language, and Region > Region and Language.
- Open Administrative tab.
- In the Language for non-Unicode programs section, click Change system locale….
- Select a target locale from the Current system locale drop-down list.
- Restart the system.
What character encoding does Windows use?
The character set most commonly used in computers today is Unicode, a global standard for character encoding. Internally, Windows applications use the UTF-16 implementation of Unicode. In UTF-16, most characters are identified by two-byte codes.
Note:
-
This answer shows how to switch the character encoding in the Windows console to
(BOM-less) UTF-8 (code page65001
), so that shells such ascmd.exe
and PowerShell properly encode and decode characters (text) when communicating with external (console) programs with full Unicode support, and incmd.exe
also for file I/O.[1] -
If, by contrast, your concern is about the separate aspect of the limitations of Unicode character rendering in console windows, see the middle and bottom sections of this answer, where alternative console (terminal) applications are discussed too.
Does Microsoft provide an improved / complete alternative to chcp 65001 that can be saved permanently without manual alteration of the Registry?
As of (at least) Windows 10, version 1903, you have the option to set the system locale (language for non-Unicode programs) to UTF-8, but the feature is still in beta as of this writing.
To activate it:
- Run
intl.cpl
(which opens the regional settings in Control Panel) - Follow the instructions in the screen shot below.
-
This sets both the system’s active OEM and the ANSI code page to
65001
, the UTF-8 code page, which therefore (a) makes all future console windows, which use the OEM code page, default to UTF-8 (as ifchcp 65001
had been executed in acmd.exe
window) and (b) also makes legacy, non-Unicode GUI-subsystem applications, which (among others) use the ANSI code page, use UTF-8.-
Caveats:
-
If you’re using Windows PowerShell, this will also make
Get-Content
andSet-Content
and other contexts where Windows PowerShell default so the system’s active ANSI code page, notably reading source code from BOM-less files, default to UTF-8 (which PowerShell Core (v6+) always does). This means that, in the absence of an-Encoding
argument, BOM-less files that are ANSI-encoded (which is historically common) will then be misread, and files created withSet-Content
will be UTF-8 rather than ANSI-encoded. -
[Fixed in PowerShell 7.1] Up to at least PowerShell 7.0, a bug in the underlying .NET version (.NET Core 3.1) causes follow-on bugs in PowerShell: a UTF-8 BOM is unexpectedly prepended to data sent to external processes via stdin (irrespective of what you set
$OutputEncoding
to), which notably breaksStart-Job
— see this GitHub issue. -
Not all fonts speak Unicode, so pick a TT (TrueType) font, but even they usually support only a subset of all characters, so you may have to experiment with specific fonts to see if all characters you care about are represented — see this answer for details, which also discusses alternative console (terminal) applications that have better Unicode rendering support.
-
As eryksun points out, legacy console applications that do not «speak» UTF-8 will be limited to ASCII-only input and will produce incorrect output when trying to output characters outside the (7-bit) ASCII range. (In the obsolescent Windows 7 and below, programs may even crash).
If running legacy console applications is important to you, see eryksun’s recommendations in the comments.
-
-
-
However, for Windows PowerShell, that is not enough:
- You must additionally set the
$OutputEncoding
preference variable to UTF-8 as well:$OutputEncoding = [System.Text.UTF8Encoding]::new()
[2]; it’s simplest to add that command to your$PROFILE
(current user only) or$PROFILE.AllUsersCurrentHost
(all users) file. - Fortunately, this is no longer necessary in PowerShell Core, which internally consistently defaults to BOM-less UTF-8.
- You must additionally set the
If setting the system locale to UTF-8 is not an option in your environment, use startup commands instead:
Note: The caveat re legacy console applications mentioned above equally applies here. If running legacy console applications is important to you, see eryksun’s recommendations in the comments.
-
For PowerShell (both editions), add the following line to your
$PROFILE
(current user only) or$PROFILE.AllUsersCurrentHost
(all users) file, which is the equivalent ofchcp 65001
, supplemented with setting preference variable$OutputEncoding
to instruct PowerShell to send data to external programs via the pipeline in UTF-8:- Note that running
chcp 65001
from inside a PowerShell session is not effective, because .NET caches the console’s output encoding on startup and is unaware of later changes made withchcp
; additionally, as stated, Windows PowerShell requires$OutputEncoding
to be set — see this answer for details.
- Note that running
$OutputEncoding = [console]::InputEncoding = [console]::OutputEncoding = New-Object System.Text.UTF8Encoding
- For example, here’s a quick-and-dirty approach to add this line to
$PROFILE
programmatically:
'$OutputEncoding = [console]::InputEncoding = [console]::OutputEncoding = New-Object System.Text.UTF8Encoding' + [Environment]::Newline + (Get-Content -Raw $PROFILE -ErrorAction SilentlyContinue) | Set-Content -Encoding utf8 $PROFILE
-
For
cmd.exe
, define an auto-run command via the registry, in valueAutoRun
of keyHKEY_CURRENT_USERSoftwareMicrosoftCommand Processor
(current user only) orHKEY_LOCAL_MACHINESoftwareMicrosoftCommand Processor
(all users):- For instance, you can use PowerShell to create this value for you:
# Auto-execute `chcp 65001` whenever the current user opens a `cmd.exe` console
# window (including when running a batch file):
Set-ItemProperty 'HKCU:SoftwareMicrosoftCommand Processor' AutoRun 'chcp 65001 >NUL'
Optional reading: Why the Windows PowerShell ISE is a poor choice:
While the ISE does have better Unicode rendering support than the console, it is generally a poor choice:
-
First and foremost, the ISE is obsolescent: it doesn’t support PowerShell (Core) 7+, where all future development will go, and it isn’t cross-platform, unlike the new premier IDE for both PowerShell editions, Visual Studio Code, which already speaks UTF-8 by default for PowerShell Core and can be configured to do so for Windows PowerShell.
-
The ISE is generally an environment for developing scripts, not for running them in production (if you’re writing scripts (also) for others, you should assume that they’ll be run in the console); notably, with respect to running code, the ISE’s behavior is not the same as that of a regular console:
-
Poor support for running external programs, not only due to lack of supporting interactive ones (see next point), but also with respect to:
-
character encoding: the ISE mistakenly assumes that external programs use the ANSI code page by default, when in reality it is the OEM code page. E.g., by default this simple command, which tries to simply pass a string echoed from
cmd.exe
through, malfunctions (see below for a fix):
cmd /c echo hü | Write-Output
-
Inappropriate rendering of stderr output as PowerShell errors: see this answer.
-
-
The ISE dot-sources script-file invocations instead of running them in a child scope (the latter is what happens in a regular console window); that is, repeated invocations run in the very same scope. This can lead to subtle bugs, where definitions left behind by a previous run can affect subsequent ones.
-
-
As eryksun points out, the ISE doesn’t support running interactive external console programs, namely those that require user input:
The problem is that it hides the console and redirects the process output (but not input) to a pipe. Most console applications switch to full buffering when a file is a pipe. Also, interactive applications require reading from stdin, which isn’t possible from a hidden console window. (It can be unhidden via
ShowWindow
, but a separate window for input is clunky.)
-
If you’re willing to live with that limitation, switching the active code page to
65001
(UTF-8) for proper communication with external programs requires an awkward workaround:-
You must first force creation of the hidden console window by running any external program from the built-in console, e.g.,
chcp
— you’ll see a console window flash briefly. -
Only then can you set
[console]::OutputEncoding
(and$OutputEncoding
) to UTF-8, as shown above (if the hidden console hasn’t been created yet, you’ll get ahandle is invalid error
).
-
[1] In PowerShell, if you never call external programs, you needn’t worry about the system locale (active code pages): PowerShell-native commands and .NET calls always communicate via UTF-16 strings (native .NET strings) and on file I/O apply default encodings that are independent of the system locale. Similarly, because the Unicode versions of the Windows API functions are used to print to and read from the console, non-ASCII characters always print correctly (within the rendering limitations of the console).
In cmd.exe
, by contrast, the system locale matters for file I/O (with <
and >
redirections, but notably including what encoding to assume for batch-file source code), not just for communicating with external programs in-memory (such as when reading program output in a for /f
loop).
[2] In PowerShell v4-, where the static ::new()
method isn’t available, use $OutputEncoding = (New-Object System.Text.UTF8Encoding).psobject.BaseObject
. See GitHub issue #5763 for why the .psobject.BaseObject
part is needed.
Setting method
Setting method: Control Panel->Area->Administration>Change system area settings
After setting, restart, the system code will change to UTF-8 format.
Known issues:
I just started using it, I haven’t found any more problems, I will continue to add it later
1. Custom configuration file garbled
As shown in the figure below, I write the following content in a folder to make the folder display my custom Chinese name, but when I set Windows to UTF-8, this file will not be automatically changed and needs to be manually changed to UTF- After 8 can be used normally, otherwise the folder display will be garbled
2.7-ZIP, WinRAR and Windows Explorer open GBK encoded zip will be garbled
WinRAR version 5.90 Simplified Chinese version
7ZIP version: 19.00
Windows version: 19041.329
3.chm help file viewer opens Chinese garbled
As shown in the figure below, the file name is not garbled here, but the title is garbled after opening, and it will be garbled when searching, and no garbled characters are found in the index and other pages.
Using Uni2Me
- It’s free but discontinued.
Using UTFCast
- Proprietary software
- Allows conversion from ANSI to UTF-8 with or without BOM
Using Notepad++
Using Python Script Plugin
from glob import glob from Npp import notepad globPath = "C:MyFiles*.txt" for file in glob(globPath): notepad.open(file) notepad.runMenuCommand("Encoding", "Convert to UTF-8-BOM") notepad.save() notepad.close()
Using Macros
- Start Macro recording
- Select Encoding > Convert to UTF-8-BOM
- Select all text and copy it (it’s a bug otherwise it will replace file contents with Clipboard content)
- Save file and close it
Using Bash
Add BOM to an already encoded UTF-8 file
echo -ne 'xEFxBBxBF' > utf8-no-bom.txt
Batch conversion using find
and iconv
# Find all .txt files and convert them to UTF-8 (assuming US characters only / ANSI) find *.txt -exec 'iconv -f CP1252 -t UTF-8 {} > {}' # all Windows character sets iconv -l | grep -i windows
Batch conversion using ls
and iconv
for i in `ls *.txt`; do iconv -f WINDOWS-1252 -t UTF8 $i -o $i.utf8 mv $i.utf8 $i done
Change in …; do
with in $@; do
to create a usable Bash file. (e.g. convert.sh myfile.txt myfile2.txt
)
Using Batch
Add BOM to all text files using nkf
for %a in (*.txt) do nkf32 -W8 -w8 --overwrite "%a"
Download binary for Windows • Source code
Note: Change -w8
with -w80
to remove BOM
Batch conversion using for
and iconv
for %a in (*.txt) do iconv -f CP1252 -t UTF-8 "%a" > "%a"
Trivial methods
- Using paid software Replace Pioneer
- Unicode in PowerShell
- Change System Locale to Use
UTF-8
Encoding in Windows PowerShell - Set Encoding in
$PSDefaultParameterValues
Variable to UseUTF-8
Encoding in Windows PowerShell
This tutorial will teach you to use UTF-8
encoding in Windows PowerShell.
Unicode in PowerShell
Unicode is a worldwide character encoding standard. It defines how characters in text files, web pages, and other documents are represented.
The computer system uses Unicode to manipulate characters and strings. The default encoding in PowerShell is Windows-1252
.
Unicode was developed to support characters from all languages of the world. PowerShell supports a Unicode character encoding by default.
UTF-8
and UTF-16
are the most common Unicode encodings. PowerShell always uses BOM
in all Unicode encodings except UTF7
.
The BOM
(byte-order-mark) is a Unicode signature included at the first few bytes of a file or text stream that indicates the Unicode encoding.
Change System Locale to Use UTF-8
Encoding in Windows PowerShell
There is an option to change the system locale (current language for non-Unicode programs) in Windows. But this feature is still in beta.
Go to Region Settings
from the Control Panel
or open intl.cpl
from the Run
program.
Open the Administrative
tab and click Change system locale
. Then check the Beta option as shown in the image below.
After that, press OK
and restart the computer to apply the settings.
After restarting the computer, you can check the $OutputEncoding
variable to view the current encoding.
Output:
As you can see, the current encoding is Unicode (UTF-8).
BodyName : utf-8
EncodingName : Unicode (UTF-8)
HeaderName : utf-8
WebName : utf-8
WindowsCodePage : 1200
IsBrowserDisplay : True
IsBrowserSave : True
IsMailNewsDisplay : True
IsMailNewsSave : True
IsSingleByte : False
EncoderFallback : System.Text.EncoderReplacementFallback
DecoderFallback : System.Text.DecoderReplacementFallback
IsReadOnly : True
CodePage : 65001
Now, you can view the characters of other languages in PowerShell.
Output:
Set Encoding in $PSDefaultParameterValues
Variable to Use UTF-8
Encoding in Windows PowerShell
You can run the following command to activate the UTF-8
encoding in PowerShell.
$PSDefaultParameterValues = @{'*:Encoding' = 'utf8'}
It is only valid for the current PowerShell console. It will be reset to default after you exit the PowerShell window.
Output:
Several cmdlets in PowerShell have the -Encoding
parameter to specify the encoding for different character sets. Some of them are Add-Content
, Set-Content
, Get-Content
, Export-Csv
, Out-File
, etc.
The -Encoding
parameter supports these values: ascii
, bigendianunicode
, oem
, unicode
, utf7
, utf8
,utf8BOM
, utf8NoBOM
, utf32
.
We hope this tutorial gave you an idea of using UTF-8 Encoding (CHCP 65001) in Windows PowerShell.
Кодировка текста – это схема нумерации символов, в которой каждому символу, цифре или знаку присвоено соответствующее число. Кодировку используют для сохранения и обработки текста на компьютере. Каждый раз при сохранении текста в файл он сохраняется с использованием определенной схемы кодирования, и при открытии этого файла необходимо использовать такую же схему, иначе восстановить исходный текст не получится. Самыми популярными кодировками для кириллицы сейчас являются UTF-8, Windows-1251 (CP1251, ANSI).
Для того чтобы программа смогла правильно открыть текстовый файл, иногда приходится вручную менять кодировку, перекодируя текст из одной схемы в другую. Например, не редко возникают проблемы с открытием файлов CSV, XML, SQL, TXT, PHP.
В этой небольшой статье мы расскажем о том, как изменить кодировку текстового файла на UTF-8, Windows-1251 или любую другую.
Блокнот Windows
Если вы используете операционную систему Windows 10 или Windows 11, то вы можете изменить кодировку текста с помощью стандартной программы Блокнот. Для этого нужно открыть текстовый файл с помощью Блокнота и воспользоваться меню «Файл – Сохранить как».
В открывшемся окне нужно указать новое название для файла, выбрать подходящую кодировку и нажать на кнопку «Сохранить».
К сожалению, для подобных задач программа Блокнот часто не подходит. С ее помощью нельзя открывать документы большого размера, и она не поддерживает многие кодировки. Например, с помощью Блокнота нельзя открыть текстовые файлы в DOS 866.
Notepad++
Notepad++ (скачать) является одним из наиболее продвинутых текстовых редакторов. Он обладает подсветкой синтаксиса языков программирования, позволяет выполнять поиск и замену по регулярным выражениям, отслеживать изменения в файлах, записывать и воспроизводить макросы, считать хеш-сумы и многое другое. Одной из основных функций Notepad++ является поддержка большого количества кодировок текста и возможность изменения кодировки текстового файла в UTF-8 или Windows 1251.
Для того чтобы изменить кодировку текста с помощью Notepad++ файл нужно открыть в данной программе. Если программа не смогла правильно определить схему кодирования текста, то это можно сделать вручную. Для этого нужно открыть меню «Кодировки – Кириллица» и выбрать нужный вариант.
После открытия текста можно изменить его кодировку. Для этого нужно открыть меню «Кодировки» и выбрать один из вариантов преобразования. Notepad++ позволяет изменить текущую кодировку текста на ANSI (Windows-1251), UTF-8, UTF-8 BOM, UTF-8 BE BOM, UTF-8 LE BOM.
После преобразования файл нужно сохранить с помощью меню «Файл – Сохранить» или комбинации клавиш Ctrl-S.
Akelpad
Akelpad (скачать) – достаточно старая программа для работы с текстовыми файлами, которая все еще актуальна и может быть полезной. Фактически Akelpad является более продвинутой версией стандартной программы Блокнот из Windows. С его помощью можно открывать текстовые файлы большого размера, которые не открываются в Блокноте, выполнять поиск и замену с использованием регулярных выражений и менять кодировку текста.
Для того чтобы изменить кодировку текста с помощью Akelpad файл нужно открыть в данной программе. Если после открытия файла текст не читается, то нужно воспользоваться меню «Файл – Открыть».
В открывшемся окне нужно выделить текстовый файл, снять отметку «Автовыбор» и выбрать подходящую кодировку из списка. При этом в нижней части окна можно видеть, как будет отображаться текст.
Для того чтобы изменить текущую кодировку текста нужно воспользоваться меню «Файл – Сохранить как» и сохранить документ с указанием новой схемы кодирования.
В отличие от Notepad++, текстовый редактор Akelpad позволяет сохранить файл в практически любой кодировке. В частности, доступны Windows 1251, DOS 886, UTF-8 и многие другие.
Посмотрите также:
- Чем открыть PDF файл в Windows 7 или Windows 10
- Как перевернуть страницу в Word
- Как копировать текст с помощью клавиатуры
- Как сделать рамку в Word
- Как сделать буклет в Word
Автор
Александр Степушин
Создатель сайта comp-security.net, автор более 2000 статей о ремонте компьютеров, работе с программами, настройке операционных систем.
Остались вопросы?
Задайте вопрос в комментариях под статьей или на странице
«Задать вопрос»
и вы обязательно получите ответ.
Download PC Repair Tool to quickly find & fix Windows errors automatically
If you want to change the default character encoding in Notepad in Windows 11/10, this tutorial will guide you through the process. It is possible to change the default encoding from UTF-8 to ANSI or other using the Registry Editor. Notepad started using UTF-8 as the default character encoding – it used ANSI as the default encoding.
Let’s assume that you have a text file showing some unusual characters such as “ð???”. If you want to extract the original human-readable text out of these strange characters, you may need to switch between character encodings.
We have already shown the process to change the character encoding in the Outlook app, now let us see how to do it for Notepad. While Notepad allows you to change the encoding while saving the file, it is better to change it while creating or editing a file. The following character encodings are available:
- ANSI
- UTF-16 LE
- UTF-16 BE
- UTF-8
- UTF-8 with BOM
Precaution: As you will use Registry Editor, it is recommended to backup all Registry files and create a System Restore point.
To change default encoding in Notepad, follow these steps-
- Press Win+R to open the Run prompt.
- Type regedit and hit the Enter button.
- Click on the Yes button.
- Navigate to Notepad in HKCU.
- Right-click on Notepad > New > DWORD (32-bit) Value.
- Name it as iDefaultEncoding.
- Double-click on it to set the Value data.
- Click the OK button.
You will have to open the Registry Editor on your computer. For that, press Win+R, type regedit
, and hit the Enter button. If the UAC prompt appears, click on the Yes button. After opening the Registry Editor, navigate to the following path-
HKEY_CURRENT_USERSOFTWAREMicrosoftNotepad
Right-click on Notepad and select New > DWORD (32-bit) Value.
Once it is created, name it as iDefaultEncoding. Now, double-click on iDefaultEncoding and set the Value data as following-
- ANSI: 1
- UTF-16 LE: 2
- UTF-16 BE: 3
- UTF-8 BOM: 4
- UTF-8: 5
After setting the Value data, click on the OK button to save the change.
Once done, restart the Notepad app to find the difference. You can see the selected character encoding in the Status Bar.
In case you want to get back to the original, navigate to the same path in the Registry Editor and right-click on iDefaultEncoding. Then, select the Delete button and confirm the removal.
Hope all goes well.
Anand Khanse is the Admin of TheWindowsClub.com, a 10-year Microsoft MVP (2006-16) & a Windows Insider MVP (2016-2022). Please read the entire post & the comments first, create a System Restore Point before making any changes to your system & be careful about any 3rd-party offers while installing freeware.