Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-14-2008, 07:41 AM
Member
 
Join Date: Feb 2008
Posts: 1
rovshanb is on a distinguished road
Unicode problem
Hello,

I've developed a web application (on Windows+Oracle XE) and deployed it into production (Suse+Oracle 10g).
However I have problems inserting unicode characters into database tables in the production environment.

For example I use following jsp code to insert a category name into table:

Code:
<%@page contentType="text/html" pageEncoding="UTF-8"%> <%@page import="java.sql.*,javax.sql.DataSource,javax.naming.*,com.smile.dalc.*" %> <% request.setCharacterEncoding("UTF-8"); response.setCharacterEncoding("UTF-8"); WebPushCategoryDALC.AddWebPushCategory(-1, "Şəkil", 2, 1); //hardcoded unicode characters for testing out.print("ok"); %>
On Windows it shows ok, but on Suse I have question marks inserted instead of the unicode characters. The column type is nvarchar2.

Below are results of executing the following query both on Windows and Suse:

select * from v$nls_parameters;

Windows:
"Parameter" "Value"
"NLS_CALENDAR" "GREGORIAN"
"NLS_CHARACTERSET" "AL32UTF8"
"NLS_COMP" "BINARY"
"NLS_CURRENCY" "$"
"NLS_DATE_FORMAT" "DD-MON-RR"
"NLS_DATE_LANGUAGE" "AMERICAN"
"NLS_DUAL_CURRENCY" "$"
"NLS_ISO_CURRENCY" "AMERICA"
"NLS_LANGUAGE" "AMERICAN"
"NLS_LENGTH_SEMANTICS" "BYTE"
"NLS_NCHAR_CHARACTERSET" "AL16UTF16"
"NLS_NCHAR_CONV_EXCP" "FALSE"
"NLS_NUMERIC_CHARACTERS" ".,"
"NLS_SORT" "BINARY"
"NLS_TERRITORY" "AMERICA"
"NLS_TIMESTAMP_FORMAT" "DD-MON-RR HH.MI.SSXFF AM"
"NLS_TIMESTAMP_TZ_FORMAT" "DD-MON-RR HH.MI.SSXFF AM TZR"
"NLS_TIME_FORMAT" "HH.MI.SSXFF AM"
"NLS_TIME_TZ_FORMAT" "HH.MI.SSXFF AM TZR"

Suse:
"Parameter" "Value"
"NLS_CALENDAR" "GREGORIAN"
"NLS_CHARACTERSET" "CL8ISO8859P5"
"NLS_COMP" "BINARY"
"NLS_CURRENCY" "$"
"NLS_DATE_FORMAT" "DD-MON-RR hh24:mi:ss"
"NLS_DATE_LANGUAGE" "AMERICAN"
"NLS_DUAL_CURRENCY" "$"
"NLS_ISO_CURRENCY" "AMERICA"
"NLS_LANGUAGE" "AMERICAN"
"NLS_LENGTH_SEMANTICS" "BYTE"
"NLS_NCHAR_CHARACTERSET" "AL16UTF16"
"NLS_NCHAR_CONV_EXCP" "FALSE"
"NLS_NUMERIC_CHARACTERS" ".,"
"NLS_SORT" "BINARY"
"NLS_TERRITORY" "AMERICA"
"NLS_TIMESTAMP_FORMAT" "DD-MON-RR HH.MI.SSXFF AM"
"NLS_TIMESTAMP_TZ_FORMAT" "DD-MON-RR HH.MI.SSXFF AM TZR"
"NLS_TIME_FORMAT" "HH.MI.SSXFF AM"
"NLS_TIME_TZ_FORMAT" "HH.MI.SSXFF AM TZR"

First I wanted to try to change the nls_characterset on Suse to the one on Windows, but then I saw that nls_nchar_characterset is al16utf16 and I use nvarchar2 for my table.

When connecting to Oracle using Oracle SQL Developer and inserting some records with unicode characters into nvarchar2 columns they are displayed correctly in the JSP ui. But unicode characters that are inserted from my application are converted into question marks. The application is hosted by Tomcat 6

Java versions:

Windows:
C:\Users\itrovshan>java -version
java version "1.6.0_03"
Java(TM) SE Runtime Environment (build 1.6.0_03-b05)
Java HotSpot(TM) Client VM (build 1.6.0_03-b05, mixed mode)

Suse:
java version "1.5.0"
Java(TM) 2 Runtime Environment, Standard Edition (build pxi32dev-20061002a (SR3) )
IBM J9 VM (build 2.3, J2RE 1.5.0 IBM J9 2.3 Linux x86-32 j9vmxi3223-20061001 (JIT enabled)
J9VM - 20060915_08260_lHdSMR
JIT - 20060908_1811_r8
GC - 20060906_AA)
JCL - 20061002


Could you please, help me to find out how I can fix this problem?

Thanks in advance!
Rovshan
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
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

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
TextArea with Unicode Java Tip javax.swing 0 04-16-2008 11:53 PM
regular expression for unicode tharhan Advanced Java 0 04-01-2008 11:53 PM
Use unicode in iReport to produce reports nasir_7b Advanced Java 0 03-17-2008 12:53 PM
Help unicode character JT4NK3D New To Java 3 11-18-2007 08:55 AM
Write unicode into file vata2999 New To Java 1 08-08-2007 04:04 PM


All times are GMT +3. The time now is 08:40 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org