0

I searched for a lot of answers here but i still have a problem with the UTF8. "Special" letters doesn't appear in my browser. I'm using: php Designer 8 Wampserver 3.1.4_x86 MySQL 5.6 Navicat100_premium I'm using Google

[This is what appears in my page those "?" are all "çççççççç"

This is the beginning of the code:

<html>
<title> APPACDM </title>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css"/>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"/>
header('Content-type: text/html; charset=utf-8');
<head>
    <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1">
WAV3X
  • 9
  • 2
  • 3
    *"I searched for a lot of answers here"* ... Did you find [this one](https://stackoverflow.com/questions/279170/utf-8-all-the-way-through/279279)? - it's pretty much the defacto answer to every UTF-8 issue you could possibly experience. – CD001 Feb 26 '19 at 16:22
  • 1
    Can you share your code so we can help you better? – Flavio Caruso Feb 26 '19 at 16:22

2 Answers2

1

Everything looks in the wrong order to me. If this is a HTML page with embedded PHP try this:

<?php
    header('Content-type: text/html; charset=utf-8');
?>
<!DOCTYPE html>
<html>
<head>
    <title> APPACDM </title>
    <meta name="viewport" content="width=device-width, initial-scale=1"/>
    <link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css"/>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"/>
    <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1">
</head>

Note: always set your PHP Header response before any HTML output. Always wrap PHP in PHP tags, not plain text as in your example.

See here: PHP Header command

Thanks,

Shaun.

Shaun Bebbers
  • 179
  • 2
  • 12
0

If this data is queried from a database then you can do the following:
[PDO version]

$bdd->exec("set names utf8");

[MYSQLI version]

mysqli_set_charset($bdd, "utf8");
Tibs
  • 735
  • 5
  • 16
WolfCode
  • 145
  • 1
  • 8