Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Oracle Miscellaneous > Re: Problem wit...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 5 Topic 6835 of 7279
Post > Topic >>

Re: Problem with Unicode Strings

by Carlos <miotromailcarlos@[EMAIL PROTECTED] > Apr 15, 2008 at 08:13 AM

On Apr 15, 3:04 pm, "Andr=E9 Hartmann" <andrehartm...@[EMAIL PROTECTED]
>
wrote:
> Hi,
>   I am having trouble with stuffing in an getting out unicode strings
> into/from my database. I will briefly describe what I am doing, hoping
tha=
t
> someone can point me to a mistake and end my weeks of trying...
>
> * Oracle 9i client and server, connecting via OCI from a C++ (MS Dev
Studi=
o
> 2005) application
> * Client OS: German Windows XP, SP2
> * Server: Oracle9.2.0.1 Enterprise on Windows XP SP2,
NLS_LANGUAGE=3DAMERI=
CAN
> * Server character set (determined via "select value from
> nls_database_parameters where parameter=3D'NLS_CHARACTERSET';"):
WE8MSWIN1=
252
> * Client character set GERMAN_GERMANY.WE8MSWIN1252 (determined via
"sqlplu=
s
> /nolog" and @[EMAIL PROTECTED]
)
>
>   What I am doing in my program to stuff unicode in is this:
>
> std::wstring strUnicode(L"=C2b=E7=A9=BE=FC??d=E9=F1f??");//not correctly
d=
isplayed here
> because this message is not unicode
> ...
> wchar_t* pValue =3D (pWS_ =3D=3D NULL) ? NULL : _wcsdup(
strUnicode.c_str(=
) );
> size_t nSize =3D (pValue =3D=3D NULL) ? 0 : (sizeof(wchar_t) * (1 +
> wcslen(pValue)));
> ...
> swdReturnCode =3D OCIBindByPos (
> (OCIStmt*) m_pOCIStatement,
> (OCIBind**) &pBindHandle,
> (OCIError*) m_pConnection->_getOCIError(),
> (ub4) columnIndex_,
> (dvoid*) pValue,
> (sb4) nSize,
> (ub2) SQLT_STR,
> (dvoid*) NULL,
> (ub2*) NULL,
> (ub2*) NULL,
> (ub4) NULL,
> (ub4*) NULL,
> (ub4) OCI_DEFAULT
> );
> ub2 csid =3D OCI_UTF16ID;
> swdReturnCode =3D OCIAttrSet(
> (void *) pBindHandle
> , (ub4) OCI_HTYPE_BIND
> , (void *) &csid
> , (ub4) 0
> , (ub4) OCI_ATTR_CHARSET_ID
> , m_pConnection->_getOCIError()
> );
> ...
>
>   The string that I am stuffing in corresponds to the following sequence
o=
f
> integers in my program's main memory:
>
> 194,98,231,169,190,252,1046,950,100,233,241,102,1715,1492
>
>   When I select I get the following back (displayed as
"=C2b=E7=A9=BE=FC=
=BF=BFd=E9=F1f=BF=BF"):
>
> 194,98,231,169,190,252,191,191,100,233,241,102,191,191
>
>   So it turns out that some characters have been transformed to be
> upsode-down question marks. I see the same thing when I dont fetch with
my=

> application but with the Oracle Enterprose Manager.
>
>   What is wrong here? Am I missing out some im****tant conversion on the
wa=
y?
> Thanks in advance,
> Andr=E9
> :)

I cannot see the point of storing UNICODE (UTF8? UTF16?) in a
WE8MSWIN1252 database... (you don't specify the NLSup****t codepage for
NVARCHARS/NCHARS)

The DB codepage should be unicode  (AL32UTF8).

Cheers.

Carlos.
 




 5 Posts in Topic:
Problem with Unicode Strings
"André Hartmann"  2008-04-15 15:04:53 
Re: Problem with Unicode Strings
Carlos <miotromailcarl  2008-04-15 08:13:48 
Re: Problem with Unicode Strings
"André Hartmann"  2008-04-15 17:26:26 
Re: Problem with Unicode Strings
Carlos <miotromailcarl  2008-04-16 05:44:02 
Re: Problem with Unicode Strings
joel garry <joel-garry  2008-04-16 11:28:40 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Mon Dec 1 21:10:33 CST 2008.