Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

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,071 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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…
Originally, this post was published on Monitis Blog, you can check it here . Websites are getting bigger and more complicated by the day. Video, images and custom fonts are all great for showcasing your product or service. But the price to pay in…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

718 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