PHP MySQL Chinese content display garbled

Source: Internet
Author: User
Tags mysql version php code php mysql win32

MySQL version: Mysql-4.1.21-win32.exe
Apache Version: Apache_1.3.37-win32-x86-no_src.msi
Operating system: WinXP + SP2
PHP Version: Php-4.4.3-win32.zip

My site is currently supported in both Chinese and English and will need to support other languages in the future.

So I used the UTF8 when I created the database.
I used the pear + Smarty
The PHP code is as follows:
$user = Db_dataobject::factory (' users ');
$user->query ("SELECT * from Users where user_id=1");
$user->fetch ();
$smarty->assign (' user ', $user);
$smarty->display (' Index.tpl ');
Template file:
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 strict//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" &G T

<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/>
<title>6666</title>

<body>
{$user->name}
</body>

But the question mark is displayed, the English word is normal.
1. The phpMyAdmin display can also display Chinese correctly.
2. Use the command prompt to display is garbled.
How can i solve this problem? Thank you. Look for information on the Internet, but still not.






What code is stored in your database?

The database is stored as utf-8, and in <meta http-equiv= "Content-type content=" text/html; Charset=utf-8 "/> At the same time, the file should also be saved as Utf-8 format ...

$user->query ("Set names UTF8");
$user->query (&q

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