Solved

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

Posted on 2013-06-19
5
959 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 83

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 27

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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

863 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

27 Experts available now in Live!

Get 1:1 Help Now