Do you have a question? Post it now! No Registration Necessary. Now with pictures!
July 21, 2007, 8:36 pm
rate this thread
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"
in phpmyadmin i can read:
language: italian (it-utf-8)
char set: utf-8 unicode (utf8)
int hte browser meta tag: <meta http-equiv="Content-Type"
content="text/html; charset=utf-8" />
the table structure is:
question varchar(255) utf8_general_ci
answer text utf8_general_ci
so if i make select * form table where 1, the output on screen is:
1. abad?? Modify (hope that you see 2 squares after abad it would
2. academia Modify
3. agog?? Modify (hope that you see 2 squares after agog it would be
clicking on modify appear a form with a text box and a text area and
the strange is that in the form i see the right char.
in mysql the data of the table are
have you any idea?
Re: problem with charset
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
* 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
* 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.
- » =?utf-8?B?4pa64pa6WU9VUiBWQUxVQUJMRSBPUElOSU9OIENPVUxEIEVBUk4gWU9VICQzMDAwIOKXhOKXhA==?=
- — Previous thread in » PHP Scripting Forum