0

I think I have a serious problem concerning the collation of my page in connection with the BOM. After checking my page with the w3 validator I saw that at the beginning of my head.php a BOM is showing up. Problem is, after I saved my head.php in utf-8 without BOM (before it was just utf-8) all input on all pages gets messed up. More specifically the mutated vowels (äöüß etc) are now shown as ö, ä, ß and so on. How is that possible? I have actually set and saved everything to utf-8.

I have saved every page of my website as utf-8 without BOM.

The collation of my server manager on the FTP-Server is set to "utf-8". The charset of my head.php is set to utf-8:

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

The connection to my DB via PDO is set in utf-8:

$dsn = 'mysql:host=' . $this->host . ';dbname=' . $this->dbname . ';charset=utf8';
    // Set options
    $options = array(
        PDO::ATTR_PERSISTENT    => true,
        PDO::ATTR_ERRMODE       => PDO::ERRMODE_EXCEPTION,
        PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'utf8'"
    );

The collation of my databank and the data-table is set to utf8_unicode_ci.

Does someone have an idea what I can do here or where I can start looking for the problem?

EDIT: I just cannot find a mistake here. Created a simple .php file with plain text and set it the following:

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

and saved it with "utf-8 without BOM". Also checked on the text with

<?php echo "encoding:". mb_detect_encoding("öäü"); ?>

and it says: UTF-8. But still, mutated vowels are like ö, ä, ß... I really don't know what to do here.

Franky2207
  • 163
  • 2
  • 19
  • 1
    Possible duplicate of [UTF-8 all the way through](http://stackoverflow.com/questions/279170/utf-8-all-the-way-through) – domsson Mar 24 '17 at 16:19
  • Side note: if you're using HTML5, your `meta` can be simplified to `` – domsson Mar 24 '17 at 16:20
  • @domdom thanks for your help. Plz check my edit. I just cannot find what I am missing here. According to web-sniffer.net it is `Content-Type: text/html; charset=iso-8859-1` though I have no idea how this can still happen. – Franky2207 Mar 24 '17 at 18:41

1 Answers1

0

I added the following to my .htaccess:

AddDefaultCharset utf-8

and now the HTTP-Header responds correctly utf-8. Finally the mutated vowels show up like they should.

Franky2207
  • 163
  • 2
  • 19