cancel
Showing results for 
Search instead for 
Did you mean: 

character set problem

attilio_1
Frequent Advisor

character set problem

Hello,

An application use the character µ but character set is US7ASCII and there isn't it.
I have checked with the instruction
select convert(convert('µ', 'US7ASCII', 'UTF8'), 'UTF8', 'US7ASCII') from dual;
but give ? character.
Someone know which character set contain this character, or where is possible check ?
Is need set only NLS_characterset variable or also NLS_LANG variable ?

Thanks
Attilio
2 REPLIES
Yogeeraj_1
Honored Contributor

Re: character set problem

hi,

Both are equally important!

According to metalink note 158577.1, when the client NLS_LANG characterset is set to the same value as the database characterset, Oracle assumes that the data being sent or received are of the same (correct) encoding, so no conversions or checks are performed.

The data is just stored as deliverd by the client , bit by bit... No way that Oracle can find out if you "lie" by using an incorrect setup.

You should create a database with a characterset that contains ' µ '
and set the NLS_LANG on client to xxxx and on the server to xxxx.

Metalink also warns that:

It cannot be stressed enough that you need to set the NLS_LANG to the characterset that your client is actually *using*. Not to the characterset you *want* to use, if you need on your client another characterset (to display cyrillic or so) the you need to see how you can change the characterset of the client on OS level.

Setting the NLS_LANG to the characterset of the database MAY be correct but IS NOT ALWAYS correct. Please DO NOT assume that NLS_LANG needs to be ALWAYS the same as the database characterset.


Performed the following tests on a windows platform (database on Unix)

SQL> desc test11
Name Null? Type
----------------------------------------- -------- ----------------
VAL VARCHAR2(3)

SQL> insert into test11 values('µ');

1 row created.

SQL> commit;

Commit complete.

SQL> select * from test11;

VAL
---
µ

SQL>

Database = Oracle 10g.
NLS_CHARACTERSET = UTF8

hope this helps!


regards
yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
Matti_Kurkela
Honored Contributor

Re: character set problem

If that character displays correctly to me, it is known as a "micro sign" or maybe a "Greek small letter mu", depending on context.

US7ASCII clearly does not contain that character. UTF8 is Unicode, which probably has all the characters you can name and then some.

If you are using Oracle, at least the character sets W8ISO8859P1 and W8ISO8859P15 contain the micro sign. The difference between the two is mostly that the ...P1 does not contain the Euro currency symbol (â ¬), but the ...P15 does.

The database understands the micro sign if you set the NLS_... variables correctly. However, that variable affects Oracle and its tools only.

If you want to see the micro sign when using the command line, you probably have to set the LANG and/or LC_CTYPE environment variable too. This determines which character set the command line session is supporting. (See "man 5 lang" for more info.)
MK