Character Set setting when PHP + OCI accesses the Oracle database -- sqlplus garbled Solution

Source: Internet
Author: User

1. Set the environment variable NLS_LANG
 
 
To solve the Oracle client garbled problem, the key is to unify the character set used by the server with the character set used by the client.
 
 
The Oracle client (Sqlplus, OCI, etc.) uses the NLS_LANG environment variable to determine the character set used by the client.
Example: export NLS_LANG = AMERICAN_AMERICA.AL32UTF8
How to view the character set used by the server: select userenv ('language') from dual;
 
 
2. Note that when PDO uses the utf8 character set, it uses charset to pass in: "UTF-8", with a '-' in the middle '-'.
 
Example: $ oradb = "oci: dbname = // www.carffee.com: 1521/npstores; charset = UTF-8 ";
 
 
 
--
Refer:
Http://www.bkjia.com/database/201202/120377.html
Http://www.bkjia.com/database/201202/120378.html

Author: simba

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.