score:417

Accepted answer

window -> preferences -> general -> workspace : text file encoding

score:0

window>preferences>web>jsp files

score:2

what worked for me in eclipse mars was to go to window > preferences > web > html files, and in the right panel in encoding select iso 10646/unicode(utf-8), apply and ok, then and only then my .html files were created with .

score:2

to change the default encoding used for all workspaces you can do the following:

create a defaults.ini file in the eclipse configuration folder. for example, if eclipse is installed in c:/eclipse create c:/eclipse/configuration/defaults.ini. the file should contain:

org.eclipse.core.resources/encoding=utf-8

if you want to set the line terminator to unix values you can also add:

org.eclipse.core.runtime/line.separator=\n

in eclipse.ini in the eclipse install folder (e.g., c:/eclipse) add the following lines:

-plugincustomization 
d:/java/eclipse/configuration/defaults.ini

you might need to play around with where you put it. inserting it before the "-product" option seemed to work.

score:4

i was having the same problem when i received a html to put inside my project and rename it to .jsp. to solve the problem, i needed to what people above already said, that is, to change text encoding in eclipse preferences. however, before renaming the files to .jsp, it was necessary to include the following line in the beginning of each .html file:

<%@ page language="java" contenttype="text/html; charset=utf-8"
pageencoding="utf-8"%>

i believe this forced eclipse to understand that it was necessary to change file encoding when i tried to rename .html to .jsp.

score:4

if you need to edit files of same type with more encodings in different folders and projects (e.g. one project is in utf-8 and other in windows-12xx), go to window > preferences > general > content types > text > and select each type with multiple encodings.

for each type delete content of the default encoding and click update.

this way eclipse will not "autodetect" encoding and will use encoding set for project or folder.

score:5

preferences >> general >> editors >> text editors >> spelling: enconding

p.s.: eclipse indigo and juno.

score:8

for eclipse mars:

change workspace encoding:

change workspace encoding

check a file encoding: image check a file encoding

score:57

nanda's answer wasn't enough in my setup. what i needed to do is:

  • window > preferences > general > content types
  • select text > html in the tree
  • select all file associations, particularly .html
  • input "utf-8" in the text-field "default encoding"

Related Query

More Query from same tag