![]() |
UTF8 support
I want to know how can i make a script have full utf8 support? do i just use utf8_encode()/utf8_decode() ???
|
|
To make a fully working Page with UTF8 encoding you just need to follow some simple rules:
1. Make sure your Database Fields are throughout UTF8 encoded. 2. Make the Database Connection to UTF8. Just fire right after you opened the DB-Connection the following query: PHP Code:
3. Next set the encoding in your IDE to UTF8. Under Eclipse you'll find it under 'Edit/Set Encoding' = for 1 File or under 'Project/Preferences/Resource' = whole Project. Every proper Editor should be able to Set File encodings ;-) 4. Now that we have everything done on our Server Side - we just need to make sure that the Browser knows that some UTF8 encoded Data is comming - start of with the PHP header: PHP Code:
HTML Code:
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />utf8_encode() and -decode() - you would only need when you want to have Plaintext e.g. you comunicate with an external site (e.g. SMS-interface etc.) - and need to pass plain text there. Or need to convert the UTF-8 to some other format (Some pervert Example since I cant think of an better): your Database is not UTF-8 encoded - so you take the data comming from there - decode it to plaintext - and encode it again to utf8 - and now can fire it out to the browser :-) |
@Sakakuchi
thanx ill give that ago. |
Sakakuchi is right, i just now developed a project with full utf-8.
|
I did execute commands but every pages still display " ??? ".
|
| All times are GMT. The time now is 08:25 PM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0