Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Java > Java and JDK > JSP Basics
Password Reminder
Register
Register | FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old September 13th, 2005, 03: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.

Reply With Quote
  #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, well 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

Reply With Quote
  #3 (permalink)  
Old May 19th, 2006, 12:09 AM
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.

Reply With Quote
  #4 (permalink)  
Old May 19th, 2006, 12:12 AM
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.. â ă ậ ộ ơ ị ụ ư

Reply With Quote
  #5 (permalink)  
Old May 19th, 2006, 12:16 AM
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;

Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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 03:27 AM
Display Vietnamese in Crystal Report(DB Oracle) Christian_tm Crystal Reports 0 June 14th, 2006 03:49 AM



All times are GMT -4. The time now is 09:39 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
2013 John Wiley & Sons, Inc.