Last active
August 29, 2015 14:16
-
-
Save meglio/23c03436410ea0840ce2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$s = 'Iñtërnâtiônàlizætiøn-р X'; | |
$pdo = new PDO('mysql:host=localhost;dbname=fa', '...', '...', [ | |
PDO::MYSQL_ATTR_INIT_COMMAND => 'SET CHARACTER SET utf8', | |
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION | |
]); | |
$res = $pdo->query('SELECT label FROM connectors WHERE id = 18', PDO::FETCH_COLUMN, 0); | |
$sDB = $res->fetchColumn(); | |
echo "s : ".mb_detect_encoding($s)."\n"; | |
echo "sDB: ".mb_detect_encoding($sDB)."\n"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Output:
s : UTF-8
sDB: UTF-8