469,361 Members | 2,227 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,361 developers. It's quick & easy.

PHP, MySql and Encoding

Hi, I'm using mysql 4.0.18 on a web server with PHP 5.1.1 and I'm trying to
pass from the iso-8859-1 encoding to utf8, but I'm still confused about
many questions.

With which encoding data is saved in the DB when data is generated by PHP?
Does it depend to the charset of the php page? And if the string is
inserted in a page by the user in a form and then inserted in the database?

There is any setting of mysql, or any property of the db, of the table or
of the field?

Thank you,
Carlo.
Jul 22 '06 #1
2 1421
Hi Carlone,
With which encoding data is saved in the DB when data is generated by PHP?
Depends on the encoding of the database table or even the column.
Does it depend to the charset of the php page? And if the string is
inserted in a page by the user in a form and then inserted in the database?

There is any setting of mysql, or any property of the db, of the table or
of the field?
Yes, on all of those levels you mention actually. The lowest level is
column level.

To learn more about character sets in MySQL see:
http://dev.mysql.com/doc/refman/5.0/en/charset.html

HTH.
Peter.
--
http://www.phpforums.nl
Jul 22 '06 #2
Peter van Schie wrote:
Hi Carlone,
>With which encoding data is saved in the DB when data is generated by
PHP?


Depends on the encoding of the database table or even the column.
>Does it depend to the charset of the php page? And if the string is
inserted in a page by the user in a form and then inserted in the
database?

There is any setting of mysql, or any property of the db, of the table or
of the field?


Yes, on all of those levels you mention actually. The lowest level is
column level.

To learn more about character sets in MySQL see:
http://dev.mysql.com/doc/refman/5.0/en/charset.html

HTH.
Peter.
Not at all. MySQL stores the data is bytes. It does not change the
encoding at all. All the charset does is affect collation - sorting,
comparisons, etc.

As for PHP - it all depends on what you put in your strings. The string
functions (i.e. strncmp, etc.) are basically latin1. But echo, etc.
will just put out what you tell it.

Maybe explaining the problem you're having would be more help.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Jul 22 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by apchar | last post: by
8 posts views Thread by Bill Eldridge | last post: by
reply views Thread by Kenneth Illingsworth | last post: by
reply views Thread by Kenneth Illingsworth | last post: by
reply views Thread by Alcyone Oliveira | last post: by
11 posts views Thread by macca | last post: by
reply views Thread by zhoujie | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.