[Solved] Php charset information [duplicate]


Use PHP function utf8_encode

Try:

<input type="text" id="de" value="<?php echo utf8_encode($row->de); ?>" class="input" size="50"/>

Make sure that the IDE uses is configured as the default UTF-8.

This is spot-checking, ie the entire return must place this function.
To correct definitive in check as below:

In every PHP output header, specify UTF-8 as the encoding:

header('Content-Type: text/html; charset=utf-8');

mysql_*

$link = mysql_connect('localhost', 'user', 'password');
mysql_set_charset('utf8', $link);

mysql_* is deprecated

mysqli

$mysqli = new mysqli("localhost", "my_user", "my_password", "test");
$mysqli->set_charset("utf8");

PDO

$pdo = new PDO(
    'mysql:host=mysql.example.com;dbname=example_db',
    "username",
    "password",
    array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));

On the MySQL side of things, modifications to the my.ini file are required as follows:

[client]
default-character-set=UTF-8

[mysql]
default-character-set=UTF-8

[mysqld]
character-set-client-handshake = false #force encoding to uft8
character-set-server=UTF-8
collation-server=UTF-8_general_ci

[mysqld_safe]
default-character-set=UTF-8

4

solved Php charset information [duplicate]