Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2013-06-19
5
Medium Priority
?
1,100 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 84

Accepted Solution

by:
Dave Baldwin earned 668 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 668 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 664 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

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…
Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
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…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

824 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