Page 1 of 1

how to set utf-8 or ISO-8859-7 ???

Posted: Sun Apr 01, 2012 10:13 am
by Lykos22
Hi I would like some information please.

How can I set the utf-8 unicode or charset ISO-8859-7 on my dynamic web page? To give you some feedback: when I'm creating the page on my editor (btw I use Dreamweaver) and typing some text, in greek, inside a <p> tag everything looks fine, but when I preview it on the browser (firefox) all the text turns into strange symbols with no meaning at all :shock:

Any help would be appreciated.

P.S Btw jacek this maybe also a good idea for a video tutorial

Re: how to set utf-8 or ISO-8859-7 ???

Posted: Sun Apr 01, 2012 5:51 pm
by bowersbros
Set metatag to this:

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

Re: how to set utf-8 or ISO-8859-7 ???

Posted: Mon Apr 02, 2012 9:10 am
by Lykos22
do I have to do any settings and in my database or my php? if yes, could you please tell me with details so not to make any errors

Re: how to set utf-8 or ISO-8859-7 ???

Posted: Tue Apr 03, 2012 2:02 am
by jacek
You need to set it in the database too, if you go to the structure tab in phpmyadmin the thing you see under Collation is basically the charset. To change it you need to use the Operations tab, and the one you want is the very last one in the list utf8_unicode_ci.

The one that catches most people out is htmlentities, that has an optional parameter to specify the charset and it defaults to something odd so you have to do.
$string = htmlentities($string, ENT_COMPAT, 'UTF-8');
This was actually changed in the most recent version of php to make utf-8 the default.