Hello,
I'm fetching data from external database (I cannot edit it so don't suggest that please) which has internal encoding set to cp1250_general_ci.
I need to display that data as UTF-8 but I cannot get it to work. I'm using this to fetch the data:
$dsn = 'mysql:dbname=eklient;host=127.0.0.1';
$user = 'root';
$password = 'root';
try {
$dbh = new PDO($dsn, $user, $password);
} catch (PDOException $e) {
$this->view->warning = 'Connection failed: ' . $e->getMessage();
}
$sql = 'SELECT * FROM zam z WHERE z.id_object = :id_object;';
$sth = $dbh->prepare($sql, array(PDO::ATTR_CURSOR => PDO::CURSOR_FWDONLY));
$sth->execute(array(':id_object' => 1));
$data = $sth->fetchObject();
The original string is:
poznamka<br /> riadok1 ľščťžýáí
When I print it like this:
echo iconv('Windows-1250', 'UTF-8', $data->poznamka);
I get this:
poznamka<br /> riadok1 ?š??žýáí
So some characters are getting substituted with question marks. Any idea how to solve this?
Yes I do have correct meta tags in HTML.