This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JSP and the fly likes Issue with rendering French & German characters Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Issue with rendering French & German characters " Watch "Issue with rendering French & German characters " New topic
Author

Issue with rendering French & German characters

Elan Ram
Ranch Hand

Joined: Dec 14, 2006
Posts: 40
Hi,

Currently I am facing some issue with rendering French & German characters through JSP.
In firefox, all are fine and rendering properly, but the problem is with the IE 6.0. Its not displaying properly. For example:


�� � � � � � � �� this search term rendered as ��„ �� �– �� �œ �� �Ÿ �‚��



Also there is a solution in the Web says It will be resolved, if we put the URI encoding to UTF-8 in server.xml of Tomcat. But if I use the above solution, French characters are working in IE and not working in the firefox.


For more information, we are using:

1) Tomcat 5.5.x

2) In JSP, we are using following meta tag and encoding:



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



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



Note: I have tried with iso-8859-15 instead of UTF-8. But no use.

Any help or pointers highly appriciated.
Thanks in advance.


Thanks and regards,
Elan
Rajeev Desh
Greenhorn

Joined: Sep 05, 2008
Posts: 4
Try reading the value in byte stream and then convert them into UTF-8 format then ISO-8869-1 format to display in jsp.

if your variable carrying foreign language characters eg:fChar ="� � � �"
then write a method that returns it as string after convertion:
public String returnChar(String fChar){
StringBuffer buffer = new StringBuffer();
try {
ByteArrayInputStream bais = new ByteArrayInputStream(fChar.getBytes("ISO-8859-1"));
InputStreamReader isr = new InputStreamReader(bais,"UTF-8");
Reader in = new BufferedReader(isr);
int ch;
while ((ch = in.read()) > -1) {
buffer.append((char)ch);
}
in.close();
return buffer.toString();

hope this may help you / you can make a little modification to get the desired result

cheers..........
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41128
    
  45
Note that ISO-8859-15 is not the standard ISO-8859 code; that would be "ISO-8859-1".

You could check whether IE correctly picks up on the UTF-8 encoding. You could also check if the correct Unicode character codes are sent for those characters.


Ping & DNS - my free Android networking tools app
Elan Ram
Ranch Hand

Joined: Dec 14, 2006
Posts: 40
Hi Rajeev & Ulf,

IE is not sending the request header �accept-charset� itself to server side. But FF does it.
Also I have tried Rajeev solution, seems to be working to my situation. So I can go with it.

Thanks for your replies.

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60785
    
  65

"Elan R", please check your private messages for an important administrative matter.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Issue with rendering French & German characters
 
Similar Threads
Character Encoding issue with Tomcat 5.5.9
Accessing Japanese characters from text area
Struts 1.3.10 encoding problem
JSP encoding: ISO-8859 and UTF-8 differences for Spanish characters
Java Internationalization Issue for Arabic