Page 1 of 1

utf8 problems

Posted: Sat 21. Mar 2020, 07:08
by tom83
Hi,

I'm trying to migrate a php website from Plesk to KeyHelp and I'm having some weird characteres showing on the website (check print).

Image

Not sure what should I have to do. I already exported SQL from Plesk a few times, then tried to import to KeyHelp (phpmyadmin), changed to utf8, and no results.

Seems that in the database those characters are fine. In the website (some places) shows with wrong characteres.

Re: utf8 problems

Posted: Mon 23. Mar 2020, 08:58
by Alexander
Hello,

here some hints to ensure proper UTF-8 usage:

1) Use PHP-Header:

Code: Select all

header('Content-Type: text/html; charset=UTF-8');
2) Use HTML meta tag

Code: Select all

<meta charset="utf-8">

3) Set the database connection charset when connecting to the database (Choose one, depending on your application):
mysqli_set_charset / SET NAMES utf8 / PDO-DSN connection string "mysql:host=...;port=...;dbname=...;charset=utf8;"

4) Check the database charset of the database / tables (eg. with phpMyAdmin)


There are more places to check, depending on you application.

Re: utf8 problems

Posted: Mon 23. Mar 2020, 10:43
by Tobi
I think he got the solution.
sonderzeichen.png
😁