Reputation: 6854
I have been searching online for the correct encoder setting for Eclipse's text editor so that I can view special characters such as European ones (e.g. ä, ü, ß, etc.). The files that I am interested in are some SQL script files (*.sql) which I simply edit, but not run from my Eclipse project. My problem is that when I open the files using eclipse editor, those special characters appear as gibrish, but when I use things like sublime or notepad++ they are okay!. I would very much like to avoid that and be able to use eclipse.
I have tried changing the encoding settings using Window>Preferences and etc. settings. My current encoding is set for ISO-8859 (Latin-1) encoding. Does anyone have any experience in this?
Upvotes: 2
Views: 1083
Reputation: 793
You have to know what encoding your *.sql-Files use.
Apparently notepad++ guesses encoding based on the files content, that's why it works in notepad++. You can try to open the file in notepad++, then open the encoding menu and check what encoding the file has. Then go to eclipse and choose the corresponding encoding.
In general I recommend setting the encoding in eclipse to utf-8.
Edit: I tried to reproduce the problem with Eclipse Luna R2 on Windows 7 by creating a UTF-encoded file in my project folder named "test.sql" with a content of "äöü". Then I set the eclipse encoding to ISO-8859-1 and opened the file by right-clicking in Eclipse->Open With->Text Editor. Eclipse correctly displays the "äöü" string.
Could you please provide more information? What Version of Eclipse do you use? What operating system? How do you open the .sql file in eclipse? Double click? drag'n'drop?
Edit2: I could reproduce the problem by changing the project specific encoding settings: Go to Project Properties->Resource and change the Text file encoding to UTF-8. The Project setting overrides the workspace setting.
Upvotes: 1