Solved

Charset=ISO-8859-1 vs Charset=UTF-8  in header of web page or jsp page

Posted on 2013-06-19
5
928 Views
Last Modified: 2013-06-20
What is the difference between a jsp or webpage with charset=ISO-8859-1 vs charset=UTF-8?

I use Websphere IDE, and by default, Websphere designates charset=ISO-8859-1 when I create a new jsp page whereas the existing jsp pages within the application I'm modifying all specify charset=UTF-8.

Is it important to maintain the consistency of the charset designation within a single application or does it not matter?  Websphere gives me a somewhat ominous warning when I manually change the charset to UTF-8 from ISO-8859-1
0
Comment
Question by:Cy2
5 Comments
 
LVL 82

Accepted Solution

by:
Dave Baldwin earned 167 total points
ID: 39261451
'Charset=ISO-8859-1' and 'Charset=UTF-8' are two different ways of designating characters.  The lower 127 ASCII characters are the same but nothing above that is.  If you are handling non-US and non-Western languages, then UTF-8 is a better choice.  But it is important that you are consistent.  This includes any databases and communications that can be affected by the chosen character set.
0
 
LVL 75

Assisted Solution

by:Michel Plungjan
Michel Plungjan earned 167 total points
ID: 39261461
I would choose UTF8 all the way. It is a pain to bring everything from ISO to UTF so if you are consistently using UTF8 everywhere, your life will be easier no matter what happens in the future
0
 
LVL 26

Assisted Solution

by:mrcoffee365
mrcoffee365 earned 166 total points
ID: 39262727
The above are the right answers.  The reason you see a mismatch is that tomcat has ISO-8859-1 by default, and apparently the websphere folks didn't change it.

I'm not sure why there's a websphere warning about changing.  If you post the warning, we might be able to talk more with you about that.
0
 

Author Closing Comment

by:Cy2
ID: 39263152
Thanks for the input everyone.  When I previously googled UTF8 vs ISO-8859, I had also come across info that UTF-8 is a better choice for non-US/non-Western languages, but I was mystified as to why the previous developers chose UTF-8 for this particular app I'm maintaining, as the app is entirely in English and the users are all in the US!

More importantly, what if a webpage/jsp does not specify the Charset at all?  I just came across this in the application today for several more jsp pages I need to duplicate and slightly modify for a new form.  Is it a problem that no Charset type is mentioned?  The application apparently has managed without the Charset declaration for some pages, but it'd be nice to know if this is just a matter of luck that no problems have come up yet, or is the Charset declaration not an absolute necessity?  Or does Websphere possibly assume a default Charset, which in this case, would actually conflict with the UTF8 present in the rest all the webpages which do declare a charset?

Finally, the warning from websphere isn't as dire as my first impression was.  It states:

The encoding determined from the content (UTF-8) conflicts with the file property (ISO-8859-1).  Do you wish to use the encoding determined from the content?

This occured because when I initially create the jsp page on the websphere workspace, websphere does indeed put in a default charset = ISO-8859-1 as mrcoffee365 stated.  I copy and paste the entire code off of the webpage I want to reproduce and then tweak/modify; since the copied webpage had UTF-8, my copied code conflicted with the default header websphere had inserted onto the page.
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 39263586
A validator might complain about the missing charset. You may use English now, but perhaps that could change later no? For example names like Sørensen could give you issues
With UTF8 you can mix languages on the page
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
listing all functions in JavaScript 19 101
Help with HTML 7 38
Detecting robots? 5 34
Text in block not displaying properly 2 12
Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now