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!

Storing multilingual characters using CHR( n, using nchar_cs)

449957Aug 19 2008 — edited Aug 19 2008
Hi.

I'm trying to set up a DB with a sample table of the language characters our application has to support - English, Thai, Chinese and Vietnamese. I'm experimenting with the latest edition of Oracle Express, and it's using AL32UTF8 as a character set. I'm inserting data with SQL Developer and all is good, until I get to the 3-byte Vietnamese characters.

I'm inserting characters into an nvarchar2 type by doing a CHR (x, using nchar_cs) - which works for Thai and Chinese, but produces the wrong characters for Vietnamese. For them, I need to omit the "using nchar_cs" parameter. Is this right ?

create table char_test (char_id integer, hexcode char(6), int_decode integer, language varchar2(30), actual_char nvarchar2(5));
create sequence char_test_id_seq nocache;
insert into char_test (char_id, hexcode, int_decode, language, actual_char) values (char_test_id_seq.nextval,'0E01',3585, 'Thai', chr(3585 using nchar_cs));
insert into char_test (char_id, hexcode, int_decode, language, actual_char) values (char_test_id_seq.nextval,'0E02',3586, 'Thai', chr(3586 using nchar_cs));
insert into char_test (char_id, hexcode, int_decode, language, actual_char) values (char_test_id_seq.nextval,'0E03',3587, 'Thai', chr(3587 using nchar_cs));
insert into char_test (char_id, hexcode, int_decode, language, actual_char) values (char_test_id_seq.nextval,'20AC',8364, 'Euro', chr(8364 using nchar_cs));
insert into char_test (char_id, hexcode, int_decode, language, actual_char) values (char_test_id_seq.nextval,'5F00',24320, 'Chinese', chr(24320 using nchar_cs));
insert into char_test (char_id, hexcode, int_decode, language, actual_char) values (char_test_id_seq.nextval,'5173',20851, 'Chinese', chr(20851 using nchar_cs));
insert into char_test (char_id, hexcode, int_decode, language, actual_char) values (char_test_id_seq.nextval,'6728',26408, 'Chinese', chr(26408 using nchar_cs));
insert into char_test (char_id, hexcode, int_decode, language, actual_char) values (char_test_id_seq.nextval,'E1BBA3',14793635, 'Vietnamese', chr(14793635 using nchar_cs));
insert into char_test (char_id, hexcode, int_decode, language, actual_char) values (char_test_id_seq.nextval,'E1BBA3',14793635, 'Vietnamese', chr(14793635));
commit;

The first Vietnamese character is wrong - the second is right.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 16 2008
Added on Aug 19 2008
5 comments
3,704 views