Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Databases / December 2004

Tip: Looking for answers? Try searching our database.

How to put traditional Chinese text into Unicode Oracle 9i database via Internet Explorer

Thread view: 
bjwang@acs.com.tw - 23 Dec 2004 05:16 GMT
Hello wisers,

We are testing a system which is developed on top of Oracle 9iAS. The
client PCs are using Internet Explorer to access the system. We are
sure that the Oracle 9i database server is set to use Unicode. The
Oracle 9i database server and Oracle 9iAS server are now running on
English Windows 2000 server. With client PCs running on traditional
Chinese Windows 2000 or traditional Chinese Windows XP, via Internet
Explorer we put traditional Chinese text into the system then query the
data again, it displays in inverted question marks.

1. How to resolve the problem?
2. Does the Internet Explorer View -> Code Unicode (UTF-8) setting
controls content display as well as keyin?
3. Or the system controls the code interpretation of keyin?
Thanks,

Bruce
Sergey Bezrukov - 23 Dec 2004 14:17 GMT
> Hello wisers,

I think in your web-app you should use Filter, which will calls
request.setCharacterEncoding("WhatDoYouWant") because overwise,
according to spec, server should set request encoding to iso-8859-1.

There is an example:

import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class CharsetFilter implements Filter
{
 // charset
 private String encoding;

 public void init(FilterConfig config) throws ServletException
 {
  // read from config
  encoding = config.getInitParameter("requestEncoding");

  // default
  if( encoding==null ) encoding="UTF8";
 }

 public void doFilter(ServletRequest request, ServletResponse response,
FilterChain next)
 throws IOException, ServletException
 {
  request.setCharacterEncoding(encoding);
  next.doFilter(request, response);
 }

 public void destroy(){}
}

And configuration:

<!-- CharsetFilter -->
  <filter>
    <filter-name>Charset Filter</filter-name>
    <filter-class>CharsetFilter</filter-class>
      <init-param>
        <param-name>requestEncoding</param-name>
        <param-value>UTF8</param-value>
      </init-param>
  </filter>

 <!-- CharsetFilter mapping -->
  <filter-mapping>
    <filter-name>Charset Filter</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>

Hope this helps.

--
WBR,
Serge.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.