I have one php file when I get data from MySQL where I set encoding to utf8. When Im tring to get data and display it in my php file I see there is sth wrong with some characters, e.g Magia ĹwiÄt w JaseĹkach 2013-12-23
.
I create all php files using utf8 encoding, but when I want to open this file from server Notepad++ showes me that there is ANSI as utf8 encoding and newline format is Macintosh.
Connecting to db
<?php
$db = new mysqli('############');
$db->query("SET NAMES utf8");
$db->query("SET CHARACTER SET utf8");
if($db->connect_error) {
$msg = "Cant connect";
} else {
$msg = "Works!";
}
?>
<?php
require '../bootstrap/bootstrap.php';
$query = $db->real_escape_string("Select id, data_dodania,tytul, zajawka From artykuly ORDER BY data_dodania DESC");
$result = $db->query($query);
$result=$result->fetch_all();
foreach($result as $row ) {
echo '<tr>';
echo '<td>';
echo '<b>';
echo $row[2];
echo "<span class='text-info'> <small class='text-right'>$row[1] </small></span>";
echo '</b>';
echo '<br />';
echo $row[3];
echo '</td>';
echo '</tr>';
}
echo '</table>';