DZone
Java Zone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
  • Refcardz
  • Trend Reports
  • Webinars
  • Zones
  • |
    • Agile
    • AI
    • Big Data
    • Cloud
    • Database
    • DevOps
    • Integration
    • IoT
    • Java
    • Microservices
    • Open Source
    • Performance
    • Security
    • Web Dev
DZone > Java Zone > Changing Eclipse Default Encoding to UTF-8 for JSP files

Changing Eclipse Default Encoding to UTF-8 for JSP files

Veera Sundar user avatar by
Veera Sundar
·
Dec. 08, 10 · Java Zone · Interview
Like (0)
Save
Tweet
24.07K Views

Join the DZone community and get the full member experience.

Join For Free

Try creating a new JSP file in your Eclipse and you’ll notice that the JSP page directive will have encoding something like:

<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>

But for a better I18N and L10N support, it is recommended to follow UTF-8 encoding where ever possible. So, how do we change the default JSP file encoding to UTF-8 in eclipse? Simple. Just do these things:

  1. In Eclipse, go to Windows -> Preferences -> Web -> JSP Files
  2. Select UTF-8 encoding from the Encoding dropdown box there.

That’s it! And if you wonder how this change works, you can very well see that. In the same Preferences window, go to this location: Preferences -> Web -> JSP Files -> Editor -> Templates. Then in the right hand side, you’ll see a list of templates defined for JSP files.  And in a new JSP file template, you can see this code:

<%@ page language="java" contentType="text/html; charset=${encoding}" pageEncoding="${encoding}"%>

Here as you might have guessed, the ${encoding} will be replaced by whatever we set in the above step.

The same method can be used to change the default encoding type for other file types too (css, html).

From http://veerasundar.com/blog/2010/12/changing-eclipse-default-encoding-to-utf-8-for-jsp-files/

UTF-8 Eclipse

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • 3 Best Tools to Implement Kubernetes Observability
  • 12 Modern CSS Techniques For Older CSS Problems
  • Understanding Kubernetes Resource Types
  • MongoDB vs. DynamoDB Head-to-Head: Which Should You Choose?

Comments

Java Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • MVB Program
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends:

DZone.com is powered by 

AnswerHub logo