RE: problem to display diacritic characters in JSP

Ketkee A, modified 14 Years ago. Junior Member Posts: 78 Join Date: 3/10/11 Recent Posts
Hi All,

I have a problem displaying diacritic characters in JSP. so certain German anf Frendch characters are disrupted in my porltets. this happens when I refresh my page.

Could you please suggest what could be the solution for this?

Thanks.
--Ketkee
thumbnail
Ravi Kumar Gupta, modified 14 Years ago. Liferay Legend Posts: 1302 Join Date: 6/24/09 Recent Posts
is page content-type set to utf-8?
Ketkee A, modified 14 Years ago. Junior Member Posts: 78 Join Date: 3/10/11 Recent Posts
Yes, it has been set up to UTF-8

What could be the next possible solution?

Please help!
Ketkee A, modified 14 Years ago. Junior Member Posts: 78 Join Date: 3/10/11 Recent Posts
People,

can some one please help me with this issue?

this is still not resolved.

Please note this problem occurs in IE only and not in Firefox.
thumbnail
Hitoshi Ozawa, modified 14 Years ago. Liferay Legend Posts: 7942 Join Date: 3/24/10 Recent Posts
Have you set the contentType and installed necessary fonts?

<%@ page contentType="text/html;charset=your character set" %>

Also specify
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=your character set">
Ketkee A, modified 14 Years ago. Junior Member Posts: 78 Join Date: 3/10/11 Recent Posts
Hi Hitoshi,

I have the following 2 lines on all my JSPs:

<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">

but it still doesnt work.

Can u pls suggest?

--Ketkee
Ketkee A, modified 14 Years ago. Junior Member Posts: 78 Join Date: 3/10/11 Recent Posts
Please note that this problem occurs on page refresh.
thumbnail
Hitoshi Ozawa, modified 14 Years ago. Liferay Legend Posts: 7942 Join Date: 3/24/10 Recent Posts
I've seem similar questions concerning French and German not appearing correctly on IE, but I haven't seen any solution here.

I'm displaying Japanese using UTF8 and haven't had any problem. It may be better if you post your question to French or German
forum because the problem may be particular to IE for that language.

Can you try using ISO-885-9 encoding to see if that'll work.
<%@ page contentType="text/html; charset=ISO-8859-1" %>
<%
response.setContentType("text/html; charset=ISO-8859-1");
%>

The only other reference to a similar problem I know of if the following:
http://stackoverflow.com/questions/6505944/jquery-load-character-encoding-problem-in-ie
Ketkee A, modified 14 Years ago. Junior Member Posts: 78 Join Date: 3/10/11 Recent Posts
Further to this problem I tried:
response.setContentType("text/html; charset=ISO-8859-1");

does not work.

the problem occurs because I am trying to access an entire table which has been loaded through jquery ajax. this table data is then stored in session scope. and when I try to retrieve that data, the french characters inside the data are disrupted in IE.

Could you please advise further?
thumbnail
Hitoshi Ozawa, modified 14 Years ago. Liferay Legend Posts: 7942 Join Date: 3/24/10 Recent Posts
You should have told us about the jquery ajax earlier. Are you able to enter the uri for the ajax request from IE and get the data to properly appear?
Check IE's encoding when you do this to make sure it's UTF8.
Ketkee A, modified 14 Years ago. Junior Member Posts: 78 Join Date: 3/10/11 Recent Posts
Checked that.

When I make a jquery.ajax request, I get the data displayed in the browser properly.

after I get this data, I store that response under success callback in a variable in session

Now when I press F5 on my page, I access the value from that variable. This is when I get the issue.

Data coming from server is good. but retrieving from session is giving me problems.

I checked IE's encoding under View>Encoding before and after Refresh. both times, I can see it is Unicode(UTF-8).

Can you help?
thumbnail
Hitoshi Ozawa, modified 14 Years ago. Liferay Legend Posts: 7942 Join Date: 3/24/10 Recent Posts
Sorry. I'm at a loss here. I don't have any problem with Japanese characters and I don't see why with other character sets. May be just a bug with IE effecting diacritic characters.
Can you send an sample code?
Ketkee A, modified 14 Years ago. Junior Member Posts: 78 Join Date: 3/10/11 Recent Posts
Hi Hitoshi,

I have prepared a very crude dummy of the scenario where I am getting a problem for display of diacritics.

What I have done:
1. on view.jsp, I have added a jquery ajax call and loaded a list of objects which I display as a table on results.jsp. After the ajax call, data is stored in session scope by the function
storeHTMLResultFn({
shareAttrURL: '${shareAttrURL}',
htmlStoreKey: 'htmlResult',
htmlResult: message,
debug: false
});

2. at the bottom of the table(results.jsp) , I have added a text and a submit button

Steps to execute the test case of the character issue:
1. Deploy the portlet on Liferay and add it to a portal page(the portlet is under category 'Test for Encode')
2. Table of data will be displayed. At the bottom, enter data in the comments box and click on Submit button.
3. The table will be displayed again , but this time all French characters are disrupted.
4. After submit, I have redirected to a page called results-disp.jsp where I access the table data from session scope like this: ${sessionScope['htmlResult']}
5. Same is the case for the characters of date time stamp which I have added at the right top of table.

Let me know if you have trouble accessing the code and running it.

I have attached the code. Also attached are the screen shots before and after the respective operations.

Need help on this.

Thanks.
--Ketkee
Ketkee A, modified 14 Years ago. Junior Member Posts: 78 Join Date: 3/10/11 Recent Posts
Hitoshi,

attached is also the war file of the sample code which you can deploy.

--Ketkee