dbTalk Databases Forums  

MySql, PHP and Encoding

comp.databases.mysql comp.databases.mysql


Discuss MySql, PHP and Encoding in the comp.databases.mysql forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Carlone
 
Posts: n/a

Default MySql, PHP and Encoding - 07-22-2006 , 05:09 AM






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.

Reply With Quote
  #2  
Old   
Jerry Stuckle
 
Posts: n/a

Default Re: MySql, PHP and Encoding - 07-22-2006 , 09:51 AM






Carlone wrote:
Quote:
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.
Carlo,

MySQL stores whatever PHP (or any other program) tells it to store. It
does not change the encoding of the data. The charsets are just used
for collation (sorting) non-equal comparisons.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex (AT) attglobal (DOT) net
==================


Reply With Quote
  #3  
Old   
Carlone
 
Posts: n/a

Default Re: MySql, PHP and Encoding - 07-22-2006 , 12:37 PM



Il Sat, 22 Jul 2006 10:51:04 -0400, Jerry Stuckle ha scritto:
Quote:
Carlo,

MySQL stores whatever PHP (or any other program) tells it to store. It
does not change the encoding of the data. The charsets are just used
for collation (sorting) non-equal comparisons.
Ok, thanks, I think i understood..
Another question: so the data that is inserted in the DB has the encoding
of the php page? Both if it comes directly from php code or from an input
form?


Reply With Quote
  #4  
Old   
Paul Lautman
 
Posts: n/a

Default Re: MySql, PHP and Encoding - 07-22-2006 , 04:18 PM



Carlone wrote:
Quote:
Il Sat, 22 Jul 2006 10:51:04 -0400, Jerry Stuckle ha scritto:
Carlo,

MySQL stores whatever PHP (or any other program) tells it to store.
It does not change the encoding of the data. The charsets are just
used for collation (sorting) non-equal comparisons.

Ok, thanks, I think i understood..
Another question: so the data that is inserted in the DB has the
encoding of the php page? Both if it comes directly from php code or
from an input form?
There isn' treally a php page. There is an HTML page, which may be generated
by php. What Jerry meant was that PHP or any other program passes a string
of bits to MySQL and that it what MySQL stores. View that data through an
interface that assumes different encoding and you will see different things.




Reply With Quote
  #5  
Old   
Carlone
 
Posts: n/a

Default Re: MySql, PHP and Encoding - 07-22-2006 , 06:58 PM



Il Sat, 22 Jul 2006 22:18:07 +0100, Paul Lautman ha scritto:
Quote:
There isn' treally a php page. There is an HTML page, which may be generated
by php. What Jerry meant was that PHP or any other program passes a string
of bits to MySQL and that it what MySQL stores. View that data through an
interface that assumes different encoding and you will see different things.
Ok, but if i insert in a table, using a php application, some data taken
from an input form, that data has the same encoding of the html page of the
sending form or it depends also on some settings of the user's browser or
os?

Carlo.


Reply With Quote
  #6  
Old   
Jerry Stuckle
 
Posts: n/a

Default Re: MySql, PHP and Encoding - 07-22-2006 , 08:04 PM



Carlone wrote:
Quote:
Il Sat, 22 Jul 2006 22:18:07 +0100, Paul Lautman ha scritto:

There isn' treally a php page. There is an HTML page, which may be generated
by php. What Jerry meant was that PHP or any other program passes a string
of bits to MySQL and that it what MySQL stores. View that data through an
interface that assumes different encoding and you will see different things.


Ok, but if i insert in a table, using a php application, some data taken
from an input form, that data has the same encoding of the html page of the
sending form or it depends also on some settings of the user's browser or
os?

Carlo.
Carlo,

You should ask about this in an html group such as alt.html. Data
transferred between the client and the server have nothing to do with
either PHP or a database.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex (AT) attglobal (DOT) net
==================


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.