1

How do I to change the encoding on Eclipse ?

I did all of these configurations:

http://uploads.siteduzero.com/files/388001_389000/388662.png
http://uploads.siteduzero.com/files/388001_389000/388661.png
http://uploads.siteduzero.com/files/388001_389000/388660.png
http://uploads.siteduzero.com/files/388001_389000/388659.png

And

Window > Preferences > General > Workspace > 'Other UTF-8'

But, I still get this on my webpage which I had extracted from my DataBase, knowing that the encoding there is perfect (JSP page) :

http://img15.hostingpics.net/pics/136324Capturer4.jpg

and I wrote this in the top of my JSP page :

<%@ page pageEncoding="UTF-8"%>

and this into head tags of my page

<meta charset="utf-8" />

3 Answers3

1

If you add the next argument in the eclipse.ini:

-Dfile.encoding=UTF-8

And you create a new workspace or delete the .metadata directory in your current workspace (in that case, you can lost your custom configurations, like formating, cleanup...), all configurations (for Java, XML, console, JSP, HTML...) have, by default, UTF-8 encoding.

In another way, if you are using Glassfish 4 (for Java EE 7), the default encoding charset is defined by the operative system. You can check that if you test with a JSP or Servlet and print:

System.getProperty("file.encoding")
Paul Vargas
  • 41,222
  • 15
  • 102
  • 148
0

Assuming all the layers upto your jsp are sending ht eUTF-8 chars properly. Just try setting this on top of your jsp:

<%@ page contentType="text/html; charset=UTF-8" %>
Juned Ahsan
  • 67,789
  • 12
  • 98
  • 136
-1

I would guess you need to set the contentType in the response header to text/html and character set to UTF-8.

A M
  • 448
  • 5
  • 11