Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

smart quotes stored in DB are displaying as ? after jdbc select

65668Dec 3 2009 — edited Dec 16 2009
I have an Oracle 10 DB set up with the following character set

NLS_LANGUAGE AMERICAN
NLS_CHARACTERSET WE8MSWIN1252
NLS_NCHAR_CHARACTERSET AL16UTF16

I am connecting to the database using JDBC. I have a web page that is encoded using
<%@ page language="java" pageEncoding="Windows-1252" contentType="text/html;charset=Windows-1252" %>

The scenarion I am having problems with is the following. In an input field the user copies a so-called smart quote from Word and submits. I then update the corresponding database field and then return to the page and display the result.

If I display the string that I wrote to the database back in the page, without selecting it from the database, it displays correctly. However, if I select it from the database and then display it in the page I get a question mark ('?') - note that this is NOT the upside down variety.

I believe it is inserting it into the database correctly. I can go into sql plus and do a select on the field and it appears to be correct. I can also use the ascii function and it shows the character as character 145. Here is what I did:
select middle_name from employee where employee_id=100;
MIDDLE_NAME
------------------------------
select ascii(middle_name) from employee where employee_id=100;
ASCII(MIDDLE_NAME)
------------------
145

So my problem is getting it out of the database and into a java string properly.

I know I can solve this issue by changing the database character set to UTF-8, but I am not in control of this and it is not an option.

Thanks in advance for any help on this.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 13 2010
Added on Dec 3 2009
3 comments
1,158 views