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
Solved

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

Posted on 2013-06-19
5
1,002 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

Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Multiflying 2 Input Text On a Table 7 31
Asp in server side with Mssql Server 7 4 26
Accessing specific element - DOM PHP HTML 8 34
Setup GlassFish 4 21
Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
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.…
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…

791 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