Netbeans изменить кодировку файла
Я хочу изменить кодировку файла в IDE NetBeans (ver 6.9.1), скажем, из ANSII в UTF-8. Как я могу это сделать?
EDIT: Я буду более точным. Я не хочу менять кодировку по умолчанию в NetBeans. Я хочу изменить только кодировку текущего отредактированного файла.
в модели NetBeans все файлы проекта должны иметь одинаковую кодировку. Ответ заключается в том, что вы не можете сделать это в NetBeans.
Если вы работаете в Netbeans, вы должны рассмотреть возможность преобразования всех файлов в одну кодировку с помощью других инструментов.
перейдите в папку etc в NetBeans home --> открыть netbeans.conf файл и добавить on netbeans_default_options следующую строку:
перезапустите Netbeans, и он должен быть в UTF-8
для проверки перейдите в справку -- > о и проверьте систему: Windows Vista version 6.0 running on x86; UTF-8; nl_NL (nb)
в документации NetBeans просто указано иерархия для FileEncodingQuery (FEQ), предполагая, что вы can установить кодировку на основе на файл:
- Вики-статья NetBeans "DevFaqI18nFileEncodingQueryObject":кодировка проекта и кодировка файла-каковы правила приоритета, используемые в NetBeans 6.x?
просто для справки, это wiki-страница, касающаяся проекта настройки:
старая багрепорт по этому вопросу.
в обозревателе проектов щелкните правой кнопкой мыши проект, свойства - > общие - > кодировка. Это позволит вам выбрать кодировку для каждого проекта.
вы можете изменить кодировку источников или кодировку времени выполнения.
Да, вы можете изменить кодировку конкретный файл (или посмотреть, что у него есть) с этим Кодировка Поддержка плагин. С помощью этого плагина вы сможете работать с различными кодировками файлов без проблем.
теперь он находится в версии 1.4.0 для NetBeans 8.2, и я использую его в Windows 10 несколько раз назад.
операция очень проста, в строке состояния можно увидеть кодировку открытого файла, и оттуда вы можете определить его новая кодировка.
I want to change encoding of file in NetBeans IDE (ver 6.9.1), let's say from ANSII to UTF-8. How can I do that?
EDIT: I will be more precise. I don't want to change the default encoding in NetBeans. I want to only change encoding of the currently edited file.
4 Answers 4
The method by Mr. LordofFatality doesn't work for out-of-project files that you open via 'open file' menu.
In order to accomplish that, find a netbeans.conf file in you netbeans installation\etc\ , find there a netbeans_default_options line and add there -J-Dfile.encoding=UTF-8 string.
If you don't find the "netbeans_default_options" option there, add a whole new line as following:
Relevant to NetBeans 7.2, also works in 7.4
+1. IMPORTANT NOTE: make sure to put the required option (-J-Dfile.encoding=UTF8) inside quotes. You can see that all values for netbeans_default_options are stored as ONE long string enclosed in quotes.
- open the project pane if you don't see it already (Window > Projects);
- right-click on the name of your project in the tree-view;
- click properties;
- make sure the menu item "sources" on the left is highlighted;
- you should see "Encoding:" and a select-box next to it;
- click OK. Done.
It SHOULD work that way and does work for anyone on the internet except me. On my Windows XP dev system files are still not saved as UTF-8. Still wondering why .
open the project pane if you don't see it already (Window > Projects) Right-click on the name of your project in the tree-view click properties make sure the menu item "sources" on the left is highlighted you should see "Encoding:" and a select-box next to it. click ok. done.
it SHOULD work that way and does work for anyone on the internet except me. on my windows xp dev system files are still not saved as utf-8. still wondering why.
Your file should content one or more non-latin chars, this is why.
its bug always the editor saving my files as utf-8 without bom
That's a feature request titled UTF-8 files with signature (Byte Order Mark) not supported. It has nothing to do with this question.
Я использую NetBeans 6.9, не могу понять, где установить кодировку. Я нашел несколько руководств в Google, но все они были для более старых версий.
Метод господина LordofFatality не работает для файлов вне проекта, которые вы открываете через меню «Открыть файл».
Для этого найдите в себе netbeans.conf файл netbeans installation\etc\ , найдите там netbeans_default_options строку и добавьте туда -J-Dfile.encoding=UTF-8 строку.
Если вы не найдете там опцию netbeans_default_options, добавьте целую новую строку, как показано ниже:
Относится к NetBeans 7.2, также работает в 7.4.
+1. ВАЖНОЕ ПРИМЕЧАНИЕ : не забудьте заключить требуемый параметр ( -J-Dfile.encoding = UTF8 ) в кавычки . Вы можете видеть, что все значения для netbeans_default_options хранятся как ОДНА длинная строка, заключенная в кавычки.
- откройте панель проекта, если вы ее еще не видите (Окно> Проекты);
- щелкните правой кнопкой мыши имя вашего проекта в древовидной структуре;
- свойства щелчка;
- убедитесь, что пункт меню «источники» слева выделен;
- вы должны увидеть «Кодировка:» и поле выбора рядом с ним;
- нажмите ОК. Сделанный.
Он ДОЛЖЕН работать таким образом и работает для всех в Интернете, кроме меня. В моей системе Windows XP dev системные файлы по-прежнему не сохраняются как UTF-8. Все еще не понимаю, почему .
open the project pane if you don't see it already (Window > Projects) Right-click on the name of your project in the tree-view click properties make sure the menu item "sources" on the left is highlighted you should see "Encoding:" and a select-box next to it. click ok. done.
it SHOULD work that way and does work for anyone on the internet except me. on my windows xp dev system files are still not saved as utf-8. still wondering why.
Ваш файл должен содержать один или несколько нелатинских символов, вот почему.
его ошибка всегда редактор, сохраняющий мои файлы как utf-8 без бомбы
Это запрос функции под названием файлы UTF-8 с подписью (метка порядка байтов) не поддерживается . Это не имеет отношения к этому вопросу.
Я хочу изменить кодировку файла в IDE NetBeans (версия 6.9.1), скажем, с ANSII на UTF-8. Как я могу это сделать?
EDIT: Буду точнее. Я не хочу менять кодировку по умолчанию в NetBeans. Я хочу изменить только кодировку редактируемого в данный момент файла.
Not the answer you're looking for? Browse other questions tagged netbeans ide or ask your own question.
Linked
Related
Hot Network Questions
To subscribe to this RSS feed, copy and paste this URL into your RSS reader.
Site design / logo © 2022 Stack Exchange Inc; user contributions licensed under cc by-sa. rev 2022.5.12.42100
I'm running NetBeans 6.9, can't seem to figure out where to set the encoding. I found some guides on google but all of them were for older versions.
8 Answers 8
Go to etc folder in Netbeans home --> open netbeans.conf file and add on netbeans_default_options following line:
Restart Netbeans and it should be in UTF-8
To check go to help --> about and check System: Windows Vista version 6.0 running on x86; UTF-8; nl_NL (nb)
NetBeans 8.0.1 on Windows 8.1 64 bit confirmed working (just have to save the conf file to the desktop and drop back into the original folder due to Windows control-freakishness).
In NetBeans model all project files should have the same encoding. The answer is that you can't do that in Netbeans.
If you are working in Netbeans you should consider to convert all files to a single encoding using other tools.
@JohmM2, You can use jEdit to change the file-encoding if you didn't find something else better. You can convert files one by one on demand. I don't know automatic tool currently, especially if you have files of different encoding. You could possibly use iconv command line tool but I not sure that it will do work the best and that its the best tool.
For future generations - for changing encoding Notepad++ can be used. Open file, see it's encoding. convert to desired one and save.
The NetBeans documentation merely states a hierarchy for FileEncodingQuery (FEQ), suggesting that you can set encoding on a per-file basis:
- NetBeans wiki article "DevFaqI18nFileEncodingQueryObject": Project Encoding vs. File Encoding - What are the precedence rules used in NetBeans 6.x?
Just for reference, this is the wiki-page regarding project-wide settings:
- NetBeans wiki article "FaqI18nProjectEncoding": How do I set or modify the character encoding for a project?
There is an old Bugreport concerning this issue.
I know I am necro commenting, but this high-vote post above saved me. What's unbelievable is that I spent years manually configuring encoding for every sub-option in Eclipse when it's 1 line for NB?!
On project explorer, right click on the project, Properties -> General -> Encoding. This will allow you to choose the encoding per project.
I don't know about former versions of NetBeans, but currently (NetBeans IDE 8.1) this is the right solution for me. Only a little difference in the route: Properties -> Sources -> Encoding. This is because I have several projects in different languages and I could set for my projects in Spanish the encoding to ISO-8859-2 and left the rest in UTF-8 which is the recommended encoding for web projects. Thanks a lot jcarballo!
Yes, you can change the encoding of a specific file (or see what it has) with this Encoding Support plugin. With this plugin you will be able to handle the different encodings of your files without problems.
Now it is in version 1.4.0 for NetBeans 8.2 and I use it in Windows 10 several time ago.
The operation is very simple, in the status line you can see the encoding of the open file, and from there you can define its new encoding.
You can change the sources encoding or runtime encoding.
Just try to set the Projects Encoding to "UTF-8" and copy the file (which is encoded in iso) in the same Project (and if you dont need the old file just delete it) - now the copied file will be as UTF-8 - maybe this will help you :)
8 ответы
В модели NetBeans все файлы проекта должны иметь одинаковую кодировку. Ответ заключается в том, что вы не можете этого сделать в Netbeans.
Если вы работаете в Netbeans, вам следует подумать о преобразовании всех файлов в единую кодировку с помощью других инструментов.
@ JohmM2, вы можете использовать jEdit для изменения кодировки файла, если вы не нашли что-то еще лучше. Вы можете конвертировать файлы один за другим по запросу. В настоящее время я не знаю автоматического инструмента, особенно если у вас есть файлы с разной кодировкой. Вы могли бы использовать инструмент командной строки iconv, но я не уверен, что он будет работать лучше всего и что это лучший инструмент. - Владимир
Для будущих поколений - для изменения кодировки можно использовать Notepad ++. Откройте файл, посмотрите его кодировку. преобразовать в желаемый и сохранить. - Miki
Есть ли способ изменить или преобразовать всю папку и подпапки файлов? - МоннератRJ
Перейдите в папку etc в доме Netbeans -> открыть netbeans.conf файл и добавить netbeans_default_options следующая строка:
Перезапустите Netbeans, и он должен быть в UTF-8
Чтобы проверить, перейдите в раздел справки -> о и проверьте систему: Windows Vista version 6.0 running on x86; UTF-8; nl_NL (nb)
ответ дан 10 дек '13, 19:12
+1 Работал у меня на Mac 10.8 .. файл находится здесь: /Applications/NetBeans/NetBeans 7.2.1.app/Contents/Resources/NetBeans/etc/netbeans.conf - Индиго
NetBeans 8.0.1 на 8.1-разрядной версии Windows 64 подтвердил свою работу (просто нужно сохранить файл conf на рабочий стол и вернуться в исходную папку из-за неудобства управления Windows). - user1932079
Работает в Netbean 8.0.2 на Windows 8.1! - Мэриан
В Windows 10 файл можно найти по адресу C:\Program Files\NetBeans 8.1\etc\netbeans.conf - БадХорси
В документации NetBeans просто указано иерархия для FileEncodingQuery (FEQ), предлагая вам может установить кодировку для каждого файла:
Читайте также: