Member Avatar for Isidoros_1

Hello,

I built a website on my personal server and everything work fine. But when I uploaded it on the production server there is a problem with the database - the character encoding is wrong so the text is unreadable (users submit greek words).

The collation of the tables is utf8_general_ci and I've included the meta charset="utf-8" on all the pages. I've tried including header('Content-type: text/html; charset=UTF-8'); or SET NAMES UTF-8 but they didn't do anything.

What did I do wrong? Thanks for your time.

Hi,

if your problem still exists and you are using php for your website then try a conversion before display the database values with the mb_convert_encoding.

I had the same problem and fixed it as you can see in the following example

$area_name = $row['area_name'];
$area_name = mb_convert_encoding($area_name,  'UTF-8', 'ISO-8859-7');

Try to find your $from_encoding, mine was 'ISO-8859-7'

see also http://php.net/manual/en/function.mb-convert-encoding.php

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.