|
Posted by Michael Fesser on 07/21/07 23:49
..oO(cappa)
>i've some problem to print to screen and save date in mysql if the
>entries contain char like à,è...
>i try to read some post but i'm not able to solve my problem.
>
>i use easyphp 1.8 with
>apache 1.3.33-php 4.3.10-mysql 4.1.9
>SO:windows vista home premium
>
>in php.ini i've: default_charset = "utf-8"
>[...]
Without going into too much detail (I don't like phpMyAdmin and I don't
like to declare the used charset inside the document itself), just some
general comments about the way how I use UTF-8 in my own framework:
* When creating tables in my database, the fields where I think it might
be necessary are defined as UTF-8, while the rest is usually Latin-1:
CREATE TABLE example (
...
textColumn VARCHAR(100) CHARACTER SET 'utf8',
...
) ENGINE=InnoDB DEFAULT CHARACTER SET latin1;
10.3.4. Column Character Set and Collation
http://www.mysql.org/doc/refman/5.0/en/charset-column.html
* When establishing the connection to the DB, the first query that is
sent by my database script is
SET NAMES 'utf8';
This ensures that transfering the data between the DB and my scripts
will not alter the content.
10.4. Connection Character Sets and Collations
http://www.mysql.org/doc/refman/5.0/en/charset-connection.html
* Finally the content is delivered as UTF-8 to the browser. This is done
by sending an appropriate Content-Type header:
header('Content-Type: text/html; charset=UTF-8');
* * *
In short: You have to make sure that UTF-8 is used all the way from the
database storage through your scripts to the browser.
HTH
Micha
[Back to original message]
|