도 설정 데이터베이스 연결의 캐릭터 세트. 이 매개 변수를 설정하면 데이터베이스 오브젝트에 UTF-8로 인 코드 된 문자열이 전달됩니다 (데이터베이스에 저장되어 있더라도). 물론 UTF-8 형식으로 데이터를 저장하면 더 빨리 전달할 수 있습니다.
// tells the mysqli connection to deliver UTF-8 encoded strings.
$db = new mysqli($dbHost, $dbUser, $dbPassword, $dbName);
$db->set_charset('utf8');
// tells the pdo connection to deliver UTF-8 encoded strings.
$dsn = "mysql:host=$dbHost;dbname=$dbName;charset=utf8";
$db = new PDO($dsn, $dbUser, $dbPassword);
// tells the mysql connection to deliver UTF-8 encoded strings.
$db = mysql_connect($dbHost, $dbUser, $dbPassword);
mysql_set_charset('utf8', $db);
more…
당신은'SET NAMES utf8' 또는 더 나은, 클라이언트에 해당 (예를 들어 MySQL은 (내가) _set_charset)를 수행 했습니까? – julp