Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > JSP Basics
| Search | Today's Posts | Mark Forums Read
JSP Basics Beginning-level questions on JSP. More advanced coders should post to Pro JSP.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the JSP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old September 13th, 2005, 02:06 AM
Authorized User
 
Join Date: Aug 2004
Location: , , .
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to display Vietnamese Unicode on JSP page?


Hello All,

I use Oracle 9.2 , when I insert into my table as with data is Vietnamese Unicode, but I can not be show vietnamese on JSP page?

Can You help me?

Thank you so much.

Minh.

  #2 (permalink)  
Old December 10th, 2005, 05:25 PM
Registered User
 
Join Date: Dec 2005
Location: , US, .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

In order to handle Unicode characters correctly in a web-based application, we need to look into these three areas:

Data Source:
First, data source should be able to support Unicode either in file format, database or text entry field.

Browser:
At the browser end, we need to set character encoding and install a font that can display those Unicode characters. Typically, MS Arial font from Microsoft is a possible choice or any other MS Unicode fonts.

Processor:
This is where JSP should produce unicode compliant pages. I think our problem happens right here. What we have to do is modifying charset when writing a jsp page.

Currently, I think we have two possible solutions for this problem:

1) Specifying contentType and character set in JSP page directive:

In JSP page directive, we’ll specify contentType with character set we are using in the page. Remember, we have to specify it on the page where Unicode characters exist.

Either the following line

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

or

<%@ page language="java"
contentType="text/html;
charset=utf-8"
pageEncoding="utf-8"
import="java.sql.*"
%>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">

would do the job.

This way is somehow cumbersome because we have to specify contentType and charset for each page where we expect to display Unicode characters.

2) Setting CharacterEncoding of HttpServletRequest to support UTF-8

In ActionServlet or any extended AcionServlet class, I think we can modify HttpServletRequest by adding this piece of code


protected void process(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException{
try{
request.setCharacterEncoding("utf-8");
}catch(Exception ex){

}
super.process(request,response);
}

Try this and let me know the result.
Good luck,

Tan

  #3 (permalink)  
Old May 18th, 2006, 11:09 PM
Registered User
 
Join Date: May 2006
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,

        Face same problem, can u share the code to insert the vietnamese character after a post(e.g. username password). As some character(#7853; #259; #7897; #7883;) after insert to oracle 9i it become a '?'. Need expert help urgnetly. Thanks.

  #4 (permalink)  
Old May 18th, 2006, 11:12 PM
Registered User
 
Join Date: May 2006
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hmmm...this web site also doing some encoding as my input of charater become #7853. let me try others.. â ă ậ ộ ơ ị ụ ư

  #5 (permalink)  
Old May 18th, 2006, 11:16 PM
Registered User
 
Join Date: May 2006
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by suehok
 Hmmm...this web site also doing some encoding as my input of charater become #7853. let me try others.. â ă ậ á»™ Æ¡ ị ụ Æ°

Just now i change the encoding to UTF-8 before post. So try back with western encoding
#7853; #7897; #7883; #7909; #417; #432;



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to display pictures on JSP page? coitri JSP Basics 19 November 24th, 2008 06:22 AM
How to display pictures on JSP page? Kisat JSP Basics 1 November 3rd, 2008 09:02 PM
JSP page not display data coming from socket ashvinm JSP Basics 0 February 20th, 2008 02:10 AM
how to display unicode characters in datagridview usmanshakeel ASP.NET 1.x and 2.0 Application Design 0 October 19th, 2007 02:27 AM
Display Vietnamese in Crystal Report(DB Oracle) Christian_tm Crystal Reports 0 June 14th, 2006 02:49 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.