PHP garbled characters accessing Oracle! Solution

Source: Internet
Author: User
PHP garbled characters accessing Oracle! Oracle11 environment: NLS_LANG = SIMPLIFIEDCHINESE_CHINA.ZHS16GBK; PHP5default_charset & quot; gb2312 & quot; connection character: $ conn = oci_connec PHP access Oracle garbled!
Oracle 11 environment: NLS_LANG = SIMPLIFIED CHINESE_CHINA.ZHS16GBK;

PHP 5 default_charset "gb2312"

Connection character: $ conn = oci_connect ('Scott ', 'Tiger', 'demo', 'zhs16gbk ');

// Note: The 'zhs16gbk' cannot be added or changed to 'zhs16cdb231280' or 'utf-8.

SQL * Plus: No problem
PHP: No problem
INsert ...... No problem

The webpage is IE7 (IE6 also tried), and the code is simplified Chinese GB2312.

The query results show that English is normal and Chinese characters are garbled. after a few days of hard work, I am still confused. thank you!

Environment: Vista + Oracle 11 + Php 5 + Apache 2.2.8
I have tried it in XP.


------ Solution --------------------
Check the character set settings in the oracle manual!
Second, the character set in the database must be consistent with the character set at the output end of the page!
------ Solution --------------------
View --- encoding --- automatically select
Usually UTF-8
------ Solution --------------------
Add

You can.
I think it's because your file is not UTF-8
------ Solution --------------------
Add an environment variable.
NLS_NCHAR = ZHS16GBK
------ Solution --------------------
Add Environment variables
NLS_LANG = AMERICAN_AMERICA.ZHS16GBK
Restart the machine
------ Solution --------------------



------ Solution --------------------
Another thing is:
Is the definition of a database table UTF-8?
You can paste the code to see if it is useless to guess.
That is clearer.

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.