Several key points for understanding the Oracle Character Set

Source: Internet
Author: User
I often encounter some ldquo. Why is my query garbled? Rdquo; or ldquo; why do Chinese characters become garbled after I import them? Rdquo;

I often encounter some ldquo. Why is my query garbled? Rdquo; or ldquo; why do Chinese characters become garbled after I import them? Rdquo;

I often encounter "Why is my query garbled ?" Or "Why do Chinese characters become garbled after I import it ?" If you want to thoroughly understand the cause, you need to study the Oracle Character Set and the conversion relationship between them, as well as the relationship between OS Character Set, NLS_LANG and database character set. Below are some key points to understand:
1. NLS_LANG <-----> Database: ensure that the characters are the same and the binary storage can be changed.
OS <-----> NLS_LANG: the binary format of the storage remains unchanged, and the characters may be displayed differently.
2. If NLS_LANG is set to the same as the database character set, the binary storage will not undergo conversion when data is transferred through oracle net. If they are different, a conversion occurs.
3. NLS_LANG is not the encoding that we think is used to display the characters to us. The actual encoding used to display is OS encoding. If NLS_LANG is different from OS encoding, the same binary string may be displayed as a dependent string by 'you '.
4. when passing characters to a database, you should try to set NLS_LANG to the OS character set to ensure that the input 'my' TO THE NLS_LANG layer will not change characters ,, this ensures that the database stores 'me ';
However, when exporting data using client tools such as EXP, you should try to set NLS_LANG to the database character set to ensure that the exported data remains intact without data loss. During the import, set NLS_LANG to the character set of the exported file to ensure that the conversion is transferred to the database. (EXP and IMP may also cause data loss. For details, refer to the source database, the EXP client NLS_LANG, the IMP client NLS_LANG, and the character set of the target database)

5. in fact, garbled characters are actually caused by the fact that the operating system used to display characters does not find the corresponding characters in the character encoding, nor does it need to set NLS_LANG to a database character set to avoid garbled characters.

Paste two conversion diagrams of the EYGLE:

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.