Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

German characters can't be displayed in a web page.

 
Caly LeeAnn
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a JSP page which fetches the user names from the database and displays them in a drop down list through XMLHttpRequest.

The problem is the German characters are not displayed and replaced by question marks on the web page.

Those German characters are shown properly in the database and in the log file( I log the html output before send it back to the JSP file). When I print out the data through alert box, the German characters are shown as square boxes.

I tried to encode those German characters with 'UTF-8' and 'ISO-8859-1' before sending them back and decode them before showing them on the web page. But that doesn't make a difference and they are still shown as question marks.

I use IE 6.0 and it supports German characters and displays them when I visit sites in German languages. The Oracle database supports German. The JBoss application server runs on Linux box and/or Windows xp. I have the same problem no matter which JBoss I use.

What can I do to fix this problem?

Thank you.
[ January 18, 2007: Message edited by: Caly LeeAnn ]
 
Hongli Li
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know if this helps.
I did a bilingual website, which has both English and French, I escape those non English words before I insert them to the database. Haver you tried the excapeXMl="false" option from the JSTL core taglib, the German should render correctly with that setting. I just guess since I have never worked with German. XMLhttpRequest, do you mean you render the menu with Ajax call, if so, I think you have to escape those no English Characters before insertion.
[ January 18, 2007: Message edited by: Hongli Li ]
 
Caly LeeAnn
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for your reply. <cut> with escapeXml="false" doesn't work for me.

I am using the following way to handle the output.

function stateChanged_unameList() {
if (xhttp.readyState==4 || xhttp.readyState=="complete") {
var message = xhttp.responseText;
if ( message != null ) {
document.getElementById("unames").innerHTML = message;
} // if
} // if
}

I have tried to put page encoding like:

<%@page contentType="text/html;charset=UTF-8"%>
<%@page pageEncoding="UTF-8"%>

<html>
<head><title>/title>
<META http-equiv="Content-Type" content="text/html;charset=UTF-8">

I have tried 'ISO-8859-1' as well. None of them works. Are there something that I missed?
[ January 18, 2007: Message edited by: Caly LeeAnn ]
 
Paul Clapham
Sheriff
Pie
Posts: 20954
31
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I always post this article in response to questions like that.
 
Hongli Li
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you are welcome.



try this code to encode all those German characters before rendering. It works for French, not sure about German.
[ January 18, 2007: Message edited by: Hongli Li ]
 
Caly LeeAnn
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One interesting thing is the German characters are displayed properly on the web page except in the drop down box which is created using a <select> element.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64692
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Two things, Caly:

First please use UBB Code tags when posting. (read this)

Seocndly, is the problem with characters as renderred by JSP when the page is initially loaded, or as a result of your Ajax call?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64692
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Two things, Caly:

First please use UBB Code tags when posting. (read this)

Seocndly, is the problem with characters as renderred by JSP when the page is initially loaded, or as a result of your Ajax call?
 
Caly LeeAnn
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I will use the UBB Code tags.

It is a result of my Ajax call.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64692
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you.

And, I'm going to shift this over to our HTML forum where Ajax issues are usually discussed.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic