• Post Reply Bookmark Topic Watch Topic
  • New Topic

JSP Problem. Need Your Help!

 
fengzixuan zheng
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I write this code segment in my JSP file, but when it output, it does not show right. It give something like: "? ��'+"
Can you help me with this Chinese-show problem.
<% out.println("������������"); %>
 
Matthew Phillips
Ranch Hand
Posts: 2676
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You will probably get more assistance in the JSP forum. I will move it there for you.
Matthew Phillips
 
Angela Poynton
Ranch Hand
Posts: 3143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmmm I suspect an encoding problem. Not sure how to get around it but will see what I can find out.
 
Jessica Sant
Sheriff
Posts: 4313
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Depending on your Application server, there are a few ways to specify the JSP encoding -- this explains how to specify the encoding as per the JSP 1.2 spec -->
Here's a little explanation for you (from the HP Internet Server Documentation) followed by a few examples.
JSPs are processed as follows:
1-Translate JSP to XML
2-Translate XML to Java
3-Compile Java into a class file
4-Execute the class to produce content (often HTML)
-- * It is assumed that encoding of a page is ISO-8859-1 until the apperance of either the pageEncoding or contentType attributes of the JSP directive
-- * The pageEncoding attribute defines the encoding of the page. If it is not present, the behavior defaults ot pre-JSP 1.2, in that, the contentType attribute's 'charset' defines the encoding of the page. If neither is present, the encoding is ISO-8859-1
-- * The contentType attribute indicates the encoding of the entire response. If it so not present, the response encoding is ISO-8859-1
Example 1: The JSP will be read in as UTF-8 and the response willb e UTF-8 encoded

Example 2: The page will be read in as ISO-8859-1 and the response will be ISO-8859-1 encoded.

Example 3: The page will be read in as EUC-KR and the response will be EUC-KR encoded.
[CODE
<%@ page
language="java"
import="com.myco.*"
contentType="text/html;charset="EUC-KR"
%<[/CODE]

Also -- I've found that this book is very helpful:
Java Internationalization (O'Reilly)


------------------
- Jessica Bradley
HP Bluestone
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!