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

Ask about a PHP problem here.
Post Reply
Lykos22
Posts: 19
Joined: Sat Mar 24, 2012 9:03 am

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

Post 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
bowersbros
Posts: 534
Joined: Thu May 05, 2011 8:19 pm

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

Post by bowersbros »

Set metatag to this:

<META http-equiv="Content-Type" Content="text/html; charset=utf-8">
I don't like to brag, but I wasn't circumcised. I was circumnavigated. ;)

Want to learn something new? Or maybe reinforce what you already know? Or just help out? Please subscribe to my videos: http://goo.gl/58pN9
Lykos22
Posts: 19
Joined: Sat Mar 24, 2012 9:03 am

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

Post 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
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

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

Post 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.
Image
Post Reply