Character Set summary 2

Source: Internet
Author: User


Query the character set of the current database
BYS @ bys1> select userenv ('language ') from dual;

USERENV ('language ')
----------------------------------------------------
AMERICAN_AMERICA.AL32UTF8
BYS @ bys1> select * from nls_database_parameters;

PARAMETER VALUE
--------------------------------------------------
NLS_LANGUAGE AMERICAN
NLS_TERRITORY AMERICA
NLS_CURRENCY $
NLS_ISO_CURRENCY AMERICA
NLS_NUMERIC_CHARACTERS .,
NLS_CHARACTERSET AL32UTF8
NLS_CALENDAR GREGORIAN
NLS_DATE_FORMAT DD-MON-RR
NLS_DATE_LANGUAGE AMERICAN
NLS_SORT BINARY
NLS_TIME_FORMAT HH. MI. SSXFF AM
NLS_TIMESTAMP_FORMAT DD-MON-RR HH. MI. SSXF
F AM

NLS_TIME_TZ_FORMAT HH. MI. SSXFF AM TZR
NLS_TIMESTAMP_TZ_FORMAT DD-MON-RR HH. MI. SSXF
F AM TZR

NLS_DUAL_CURRENCY $
NLS_COMP BINARY
NLS_LENGTH_SEMANTICS BYTE
NLS_NCHAR_CONV_EXCP FALSE
NLS_NCHAR_CHARACTERSET UTF8
NLS_RDBMS_VERSION 11.2.0.1.0


[Oracle @ bys001 ~] $ Export NLS_LANG = AMERICAN_AMERICA.ZHS16GBK
[Oracle @ bys001 ~] $ Echo $ NLS_LANG
AMERICAN_AMERICA.ZHS16GBK

The operating system character set is used to display characters. For example, in Chinese Windows, use SSH to log on to English LINUX,
Then, use SQLPLUS to log on to the database for query. If the query result contains Chinese characters, it can be displayed.
If you directly log on to the English LINUX system and use SQLPLUS to log on to the database for query, Chinese characters cannot be displayed normally.

The client character set is set to let the database know which character set the previous character is passed,
This allows ORACLE to perform corresponding encoding ing when storing characters.


In fact, garbled characters are caused by the fact that the operating system used to display characters does not find the corresponding characters in character encoding. The main cause of this phenomenon is:
1: The OS character encoding for the input operation is inconsistent with the OS character encoding for the query, leading to garbled characters.
2: The client character set for the input operation (nls_lang) is different from the query client character set (nls_lang), which may also cause garbled or wrong characters to be returned for the query.

Another question needs to be explained:
In the preceding example, the same character set corresponds to different character encodings, which are generally called incompatible or incompatible character sets, such as zhs16gbk and al32utf8, they store the same ascii code, but different Chinese characters.
If the two character sets use the same character encoding for the same character set, we call it character compatibility. A large range is called a super character set of a small range. We usually encounter the situation of zhs16cgb231280 and zhs16gbk, which is the super of the former.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.