I am having Mysql database with column type of varchar(8192) latin2_croatian_ci
. There i insert text like this: Čćžvasfamižsafaš
(this is random text with special characters). When i preview data in mysql it does have that speical character (it wasn't replaced with ?
or something else).
I have php
page
<!DOCTYPE html>
<?php
session_start();
include("somePhpFile");
$cid = $mysqli->escape_string($_GET["id"]);
$sql = "SELECT BODY FROM ... WHERE CLANAKID = '$cid'";
if($result = $mysqli->query($sql))
{
$clanak = mysqli_fetch_assoc($result);
$body = $clanak["BODY"];
}
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Some title</title>
<link rel="stylesheet" type="text/css" href="../Styles/Clanak.css?id=4" />
<link rel="stylesheet" type="text/css" href="../Styles/DefaultBody.css" />
<meta charset="UTF-8"/>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1250">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="../jQuery/Header.js"></script>
</head>
<body>
<?php include("someHeaderphp");?>
<div id="BodyDiv">
<?php echo($body); ?>
</div>
</body>
</html>
And when i echo it inside my page all special characters get replaced with ?
and other characters. What could i do?
Here is my Show create table
:
CREATE TABLE `CLANAK` (
`CLANAKID` int(11) NOT NULL AUTO_INCREMENT,
`NASLOV` varchar(64) NOT NULL,
`BODY` varchar(8192) CHARACTER SET latin2 COLLATE latin2_croatian_ci NOT NULL,
`THUMBNAIL` varchar(1024) NOT NULL,
`AKTIVAN` int(11) NOT NULL DEFAULT '1',
PRIMARY KEY (`CLANAKID`)
) ENGINE=MyISAM AUTO_INCREMENT=7 DEFAULT CHARSET=latin1