tags:

views:

64

answers:

2

Hi,

I am using the following in my jsp page

<% response.setContentType("application/xhtml+xml"); %>

and the page renders properly except that some characters do not render correctly, for example the "copyright" character/symbol.

However, if I use:

<% response.setContentType("application/xhtml+xml;charset=UTF-8"); %>

Internet explorer renders the page as XML document (xml tree displayed) but the good thing is that all characters are resolved and displayed correctly.

Can anyone shed some light on this?

Thanks.

A: 

Duplicate? http://stackoverflow.com/questions/1758270/displaying-xhtml-content-in-a-jsp-page

Josh Barker
Please do not post comments as answers, but as comments. Check the "add comment" links.
BalusC
Mr. jbarker7: I don't think you have much to offer except for marking legitimate questions as duplicates. Or is this your strategy of scoring some points here?
m_a_khan
+1  A: 

Here's an article which explains the phenomenon "Unicode" in perspective of Java webapps: Unicode - How to get the characters right?

That said, I strongly recommend you not to use scriptlets in JSP. Just use the following:

<%@ page pageEncoding="UTF-8" %>
<!DOCTYPE whatever XHTML doctype you're using here>
<html xmlns="whatever XHTML namespace you're using here">
     <head>
         <meta http-equiv="content-type" content="application/xhtml+xml; charset=UTF-8" />
         ...

That ought to be enough.

BalusC