Skip to Main Content

Database Software

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!

Character Encoding Problem - LATIN-1 Character in UTF-8 DB

990108Feb 8 2013 — edited Feb 12 2013
I am using C++ OCI LIB, to insert some report data from remote OCI client to oracle 11 server. This data is read by another process to create the report.

The DB CHARSET is UTF-8. But the report tool expects the data to be ISO08859-1 encoded. So while inserting the data into the database i specify the following LANG and CHARSET for my table colulmn in client:

The TARGET DB CHARSET is UTF-8

NLS_LANG=AMERICAN_AMERICA.WE8ISO8859P1

size_t csid = 871; // UTF-8

OCIAttrSet((void *) bnd1p, (ub4) OCI_HTYPE_BIND,
*(void *)&csid*,
(ub4) 0,
(ub4)OCI_ATTR_CHARSET_ID, errhp);

This solution works for almost every case of ASCII and Extended ASCII Charest but we are facing issues if we have few specific characters to be inserted.

If we are trying to insert single beta character [β] through client, the data goes empty to the column.

Beta Character details:
DEC OCT HEX BIN Symbol Description
223 337 DF 11011111 ß Latin small letter sharp s - ess-zed

DB Output after insert single β:
select rawtohex(NAME) from PERSONS where EID=333;

RAWTOHEX(NAME)
---------------------------


But if the string is *"ββ"* everything work fine:
DB Output for "ββ":
select rawtohex(NAME) from PERSONS where EID=333;

RAWTOHEX(NAME)
---------------------------
DFDF

Please help me out in understanding where I am going wrong and how to resolve this.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 12 2013
Added on Feb 8 2013
6 comments
7,297 views