This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Servlets and the fly likes Non-Western European Language Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Non-Western European Language" Watch "Non-Western European Language" New topic
Author

Non-Western European Language

Kalicharan Dendage
Greenhorn

Joined: Nov 07, 2000
Posts: 2
hi all,
i am trying to display 'Japanese text' thru my servlet code... but it does not display and result in IE. when run in Netscape 6.0 it give "500 Internal Server Error
HelloJapan: java.io.UnsupportedEncodingException: Shift-JIS "
i am attaching the code also... can anybody help me ???
Start of Code**************
import java.io.*;
import java.text.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class HelloJapan extends HttpServlet {
public void doGet(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
res.setContentType("text/html; charset=Shift-JIS");
PrintWriter out = res.getWriter();
res.setHeader("Content-Language","ja");
Locale locale = new Locale("ja","");
DateFormat full = DateFormat.getDateTimeInstance(DateFormat.LONG,DateFormat.LONG,locale);
out.println("In Japanese ");
out.println("\u4eca\u65e5\u306f\u4e16\u754c");
out.println(full.format(new Date()));
} //doGet
}// HelloJapan
End of Code**************

------------------
Inside of every large program is a small program struggling to get out.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Non-Western European Language
 
Similar Threads
Locale methods - Strange Behavior
How to display Chinese in TextArea
Can't display chinese and japanese at the same time (Urgent!!!!)
Posting it again (Urgent!) Can't display chinese and japanese font at the same time
Regarding insertion of Japanese charachters in UTF-8 database