PDO read Oracle Chinese query problem

Source: Internet
Author: User
Tags dsn
I am basic small white database, PHP is also a novice. Now when accessing the Oracle database remotely with PDO, the header is in Chinese and the results are not available when queried. For example $sql=select * from AAA where station number = 1234; Return is undefined index ...
Solving... Thank you, guys.


Reply to discussion (solution)

Is your watch a file name in Chinese?
Print query Results when no filter is available (fragment is available)

Is your watch a file name in Chinese?
Print query Results when no filter is available (fragment is available)


The table name is in English, and guessing might be a character set problem. Simplified Chinese_china is displayed after executing select USERENV (' language ') from dual. Zhs16gbk
A result was printed with Print_r:
Array
(
[ID] = 7883
[???] = 3
[??] = =?
[????] = 0
)
What do you do, big God?

Oh, I'm asking the wrong question.
Your field name is obviously Chinese, this is very troublesome.
You'd better change the field name to English at the console.

Oh, I'm asking the wrong question.
Your field name is obviously Chinese, this is very troublesome.
You'd better change the field name to English at the console.


Can't change the big God, this library is not mine, and already put into use, want to change people also can't agree. How to do ah ...

How did your DSN write it?
New PDO (' oci:dbname=//server name or ip:1521/instance name; CHARSET=ZHS16GBK ', ' username ', ' password ');
This must have
Because your field name is Chinese, the character set must not be mistaken.
If you want the page to be utf-8, then you can only read and then Transcode.
If you change the name of the Chinese text to Latin, you can change the charset to get the corresponding encoded data.

How did your DSN write it?
New PDO (' oci:dbname=//server name or ip:1521/instance name; CHARSET=ZHS16GBK ', ' username ', ' password ');
This must have
Because your field name is Chinese, the character set must not be mistaken.
If you want the page to be utf-8, then you can only read and then Transcode.
If you change the name of the Chinese text to Latin, you can change the charset to get the corresponding encoded data.


Add this sentence CHARSET=ZHS16GBK the result! Thank you for the guide!

The owner again ask a question, I want to transfer the query results to UTF8 MySQL, transcoding is which function ah?

  • 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.