Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> setting OCI_ATTR_CHARSET_FORM attribute for Unicode Data

setting OCI_ATTR_CHARSET_FORM attribute for Unicode Data

From: <sachin_mzn_at_yahoo.com>
Date: Mon, 04 Jun 2007 03:13:13 -0700
Message-ID: <1180951993.294030.283650@q69g2000hsb.googlegroups.com>


Hi,

I am working on a problem related to Unicode, wherein I have to retrieve the Unicode data stored in NVARCHAR2 column (AL16UTF16).The database character set is WE8MSWIN32. I am using OCI9i API for communicating with Oracle Database Server.

As per Oracle Globalization support guide, "When you bind or define SQL NCHAR data types, you should set the OCI_ATTR_CHARSET_FORM attribute to SQLCS_NCHAR. Otherwise, you can lose data because the data is converted to the database character set before converting to or from the national character set. This occurs only if the database character set is not Unicode."

According to above statement, I need to set FORM attribute in Bind and Define handle while inputting and outputting the data respectively.

I did some test inputting UTF-8 data from OCI application to NVARCHAR2 column to verify above statement. I set NLS_LANG=.AL32UTF8

I found that, the above statement holds good while I insert the UTF-8 data ( meaning that I have to set the OCI_ATTR_CHARSET_FORM attribute in the Bind handle). But I am surprised that I am able to receive correct data in my output buffer without setting the OCI_ATTR_CHARSET_FORM attribute.

Please comment on this. I am clueless.

Thanks,
Sachin Received on Mon Jun 04 2007 - 05:13:13 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US