• Post Reply Bookmark Topic Watch Topic
  • New Topic

displaying unicode in JSP  RSS feed

 
Rao Devata
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi.
i am trying to print the arabic text on JSP page which i am getting as a String from Action class. but i am unable to get the arabic text..
instead of getting as \u0624\u0627... on the JSP page .

i had set the content type as
<%@page contentType="text/html;charset=IS0-8859-6"%>

and

<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-6" lang="ar">

<%
response.setContentType("text/html;charset=ISO-8859-6");
response.setHeader("Content-Language", "ar");
%>

Can anyone help me regarding this.

Thanks,
Rao.
 
Alec Lee
Ranch Hand
Posts: 569
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do you display your Arabic text? Are you putting them in expression tag (<%= %>)? I am not sure if this is an issue and perhaps you could test it out and advise me your result. It seems that things inside <%= %> is translated to out.print() while ordinary template text is translated to out.write() in the generated servlet. And if you look at the PrintStream.print(String) API specification, it says the character is converted to bytes according to the platform's default character encoding so I guess this would mean the character encoding of your server machine.
 
Rao Devata
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<%=
request.getAttribute("username")
%>

this is how i am getting from action class...
though its in <%= %> the same result i,e displaying unicode in JSP page..

do i need to make any changes in Action Class?
 
Alec Lee
Ranch Hand
Posts: 569
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also if your String is in unicode, isn't it "charset=UTF-8"?
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!