Michael Brenndoerfer
Michael Brenndoerfer

Reputation: 4066

UTF-8 Encoding still wrong output

I have an encoding problem.

The table uses utf8_general_ci, the php header header("Content-Type: text/html; charset=utf-8"); and in the html the meta tag <meta charset="utf-8"> is set. BOM is set right. The german chars are displayed right in phpmyadmin.

But when I output it the encoding results: Sask���

Any other idea what I can do?

Upvotes: 4

Views: 3620

Answers (2)

Avatar
Avatar

Reputation: 15176

$db = mysqli_connect(DB_HOST, DB_USER, DB_PASS);
mysqli_set_charset($db, 'utf8'); // ← SOLUTION
mysqli_select_db($db, DB_NAME);

Upvotes: 2

Michael Brenndoerfer
Michael Brenndoerfer

Reputation: 4066

This solves the problem

mysqli_query($link, "SET NAMES 'utf8'"); 
mysqli_query($link, "SET CHARACTER SET 'utf8'"); 

Upvotes: 7

Related Questions