How can I add UTF-8 support in eclipse? I want to add for example Russian language but eclipse won't support it. What should I do? Please guide me.
-
1do you want to use translated eclipse or simply change the file encoding? – soulcheck Feb 07 '12 at 17:39
-
Is this about code, or resources? UTF-8 resource support takes a bit more work. – Nyerguds Sep 06 '16 at 07:55
-
I need Chinese language support in eclipse for Selenium WebDriver tests. – Ripon Al Wasim Jun 15 '17 at 05:24
12 Answers
Try this
1)
Window > Preferences > General > Content Types
, set UTF-8 as the default encoding for all content types.2)
Window > Preferences > General > Workspace
, setText file encoding
toOther : UTF-8

- 7,413
- 13
- 50
- 94

- 11,287
- 3
- 29
- 38
-
15I wrote a blog post about this very topic which illustrates this in great detail (with screenshots etc): [Unicode/UTF-8 in your Eclipse Java projects](http://stijndewitt.wordpress.com/2010/05/05/unicode-utf-8-in-eclipse-java/) – Stijn de Witt Apr 05 '14 at 14:29
-
I am not able to accept UTF-8 characters as input from console. Scanner sc=new Scanner(System.in); sc.nextLine(); here if I give non-English characters it gets something garbage. What changes needed in setting or in program ? – Kaushik Lele Jan 16 '15 at 07:06
-
2Kaushik Lele: Your question does not relate the the question asked here. I invite you to search for your solution in other questions, or if none exist, ask your own question. – meustrus Feb 09 '15 at 17:06
-
That is pretty awful... surely the encoding of a project should be dependent on the project, not on the global Eclipse settings? – Nyerguds Sep 06 '16 at 07:48
-
2@Nyerguds: In the Package Explorer, right-click on a project and choose `Properties'. The first entry `Resource' offers exactly what you want. – Ralph Nov 30 '16 at 13:59
-
Why `Default encoding` of `JS Object Notation File` not works for `*.json`? – softwarevamp Sep 26 '19 at 03:22
Open Eclipse and do the following steps:
- Window -> Preferences -> Expand General and click Workspace, text file encoding (near bottom) has an encoding chooser.
- Select "Other" radio button -> Select UTF-8 from the drop down
- Click Apply and OK button OR click simply OK button

- 36,924
- 42
- 155
- 176

- 461
- 4
- 3
You can set a default encoding-set whenever you run eclipse.exe.
- Open eclipse.ini in your eclipse home directory Or STS.ini in case of STS(Spring Tool Suite)
- put the line below at the end of the file
-Dfile.encoding=UTF-8

- 2,409
- 1
- 20
- 23
-
don't advise, cos in my case, when i tried it didn't work, and moreover eclipse started act weird. – Farkhod Abdukodirov Mar 28 '23 at 07:50
-
@Farkhod Abdukodirov I think file encoding is not an UTF-8 when to set up your eclipse project so it might be a problem though... – tommybee Mar 29 '23 at 08:21
Just right click the Project -- Properties and select Resource on the left side menu.
You can now change the Text-file encoding to whatever you wish.

- 24,724
- 7
- 65
- 65
-
I followed the steps you mentioned above and changed into UTF-8 for console printing for Chinese an Russian languages. But unfortunately it didn't work. – Ripon Al Wasim Feb 13 '18 at 06:19
Right click on main source -> Run As -> Run Configurations -> (x)= Arguments -> VM arguments -> add:
-Dsun.stdout.encoding=UTF-8

- 163
- 1
- 11
-
it worked for me , thanks. In fact, until I reach this answer comment, I tried all, but unfortunately they didn't work, maybe it also depends on OS system environment. – Farkhod Abdukodirov Mar 28 '23 at 07:55
You can set an explicit Java default character encoding operating system-wide by setting the environment variable JAVA_TOOL_OPTIONS
with the value -Dfile.encoding="UTF-8"
. Next time you start Eclipse, it should adhere to UTF-8 as the default character set.
See https://docs.oracle.com/javase/8/docs/technotes/guides/troubleshoot/envvars002.html

- 26,371
- 26
- 130
- 172
If you have problems with JSON files, it turns out in some Eclipse versions there is an embedded JSON Validator. You can turn it off by doing the steps below:
Go to Windows->Validation and Uncheck JSON validation checkboxes

- 381
- 6
- 12
If you have Windows 11, and none of the previous answers worked, you could need to change your Region settings. Follow these steps:
Quick instructions:
Windows search > Control Panel > Region > Administrative tab > Change system locale... > check Beta: Use Unicode UTF-8 for worldwide language support
> OK > Restart now
Full instructions:
- Go to the Windows search: Press the
Win
key, or just click on theSearch
button. Another way you can go is by pressing theWin
+s
shortcut. - Type Control Panel and press
enter
key to open it, or simply click on the first search result. - Click on the
View by
dropdown menu in the upper right corner and selectCategory
(if the view is not set by Category). - Go to
Clock and Region
. - Click on
Region
. - Go to the
Administrative
tab. - In Language for non-Unicode programs, click on
Change system locale...
button. - Check the
Beta: Use Unicode UTF-8 for worldwide language support
option. - Click
OK
. - Click
Restart now
.
You should be able to see the characters properly in Eclipse.
In my case, just right click on the file you want to change the encoding -> Properties
and select Resource
on the left side menu. In Text file encoding
click other
and change to UTF-8. Hope to help you.

- 31
- 5