Passa ai contenuti principali

Mysql gestione caratteri utf8

Per gestire i caratteri ut8 seguire la seguente procedura:

nel file di configurazione di mysql, chiamato my.conf, nella sezione [mysqld] aggiungere le seguenti due linee di configurazione:


character-set-server=utf8
default-collation=utf8_unicode_ci

e riavviare il server mysql.
Creare poi un database nel formato utf8_unicode_ci e tutte le tabelle nel formato utf8_unicode_ci.

Impostare il browser da html con il supporto utf8_unicode:

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

Quando ci si connette al db:

$con = mysql_connect("localhost","user","pass"); 
mysql_query("SET CHARACTER SET 'utf8'", $con);

Quando si inserisce una nuova riga nel db, si fa nel seguente modo:

$query = "INSERT INTO table(value) VALUES ( _utf8'$node_word')";

Per maggiori dettagli clicca qui.



Post popolari in questo blog

Excel 2007: Histograms with different textures

Select the series in the histogram Open Visual Basic terminal by typing ALT + F11 Open the Visual Basic editor by typing CTRL + G In the Immediate Window, type the following and press enter: selection.fill.patterned (4) I would like to thank Diego M. Oppenheimer who wrote this wonderful guide .