I've been trying to solve the punctuation problems for two weeks now. I've already tried a good part of the solutions I found on the internet, but the problem remains.
My DB and all tables are charset="UTF-8"
and I also tried utf8_general_ci
and utf8_swedish_ci
and also latin1_general_ci
I'm also using <meta charset="UTF-8">
in my HTML
codes
I tried adding header('Content-Type: text/html; charset=iso-8859-1');
which solved the problem of the data I'm geting from the DB, but the other part of the website that is static (header and footer) is showing �� instead of ã or í and I also tried header('Content-Type: text/html; charset=UTF-8');
but diden't work.
these are some links that i tried to implement the solutions.stackoverflow superuser and others.
Does the mysql versions as anything to do with it?
<html lang="pt">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Livros Publicados</title>
</head>
<body>
<div class="container">
<div class="profileDisplay">
<a href="form.php" class="btn btn-success">Publicar</a>
<div class="row">
<?php getblogridposts("blogs");?>
<!--bloggrids-->
</div>
</div>
</div>
</body>
</html>
<?php
header('Content-Type: text/html; charset=UTF-8');
function getblogridposts($table){
$conn = mysqli_connect("localhost", "", "", "");
$sql="SELECT * FROM users ORDER BY id DESC";
if ($result=mysqli_query($conn,$sql)){
$rowcount=mysqli_num_rows($result);
if ($rowcount==0) {
echo 'Nenhum livro encontrado';
}
foreach ($result as $bloggrid => $griditem) {
echo '<div class="col-md-3 blog-grid-top">
<div class="b-grid-top">
<div class="blog_info_left_grid">
<a>
<img src="blogadmin/images/'.$griditem['profile_image'].'"
class="img-fluid" alt="fantastic cms" style="width:230px;height:250px">
</a>
</div>
<hr style="width:227px;">
<div style="width:230px;">
<h6>
<a><b>'.$griditem['bio utf8'].'</b></a>
</h6>
</div>
</div>
</div>';
}
}
mysqli_close($conn);
}
?>