How to use utf-8?
Posted: Fri Nov 17, 2006 10:33 pm
Hey there... i am working on this website that has text in many languages.
I think i have to use UTF-8 in order to be abre to displiay all kinds of character right?
Ok, first of all, the html header... i belive i should change the charsef to "UTF8", is it all it takes on the html?
then... the database table. Data outputed comes from only on table in the DB, i use latin1_swedish_ci i think i should change to utf8_unicode_ci if that's not necessary for some reason, or if there is any issues on just going and changing the table colation, please let me know, i red somewhere that utf is compatible with ascii.
Then, my biggest doubt: the sql strings parsing.
I fetch data from POST and i donta have magic_quotes_gpc on. Should i just parse any data inserted in the database with mysql_real_escape_string() then just output it as whenever necessary?
I think i have to use UTF-8 in order to be abre to displiay all kinds of character right?
Ok, first of all, the html header... i belive i should change the charsef to "UTF8", is it all it takes on the html?
Code: Select all
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
...
</head>Then, my biggest doubt: the sql strings parsing.
I fetch data from POST and i donta have magic_quotes_gpc on. Should i just parse any data inserted in the database with mysql_real_escape_string() then just output it as whenever necessary?