Ask UTF8 and GBK coding questions

Source: Internet
Author: User
With Zendstudio 10 wrote a project, is encoded with UTF8, but the database is GBK, resulting in garbled problems. Now want to change the whole project file to GBK code, ask the quickest way is?


Reply to discussion (solution)

Do not modify the character set in either the program or the database
You only need to notify MySQL what character set to use after connecting to the database
For you, the situation is
mysql_query ("Set names UTF8");

Do not modify the character set in either the program or the database
You only need to notify MySQL what character set to use after connecting to the database
For you, the situation is
mysql_query ("Set names UTF8");


I use PDO and Oracle database, how to do?
I am vaguely reminded of such a sentence:
$db = "OCI:DBNAME=//LOCALHOST:1521/ORCL;CHARSET=ZHS16GBK";
$conn = new PDO ($db, $dbuser, $dbpassword);
Is that right?

This seems to be written to Oracle no problem, but Chinese can not read it only with Iconv it?

CHARSET=ZHS16GBK is using the GBK character set
Charset=utf-8, right?

It's been a long time, forget it.

CHARSET=ZHS16GBK is using the GBK character set
Charset=utf-8, right?

It's been a long time, forget it.


Well.. It seems that all can be just a matter of time to read or write, or to turn a good trouble.
  • 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.