Unix Technical Forum

MySql, PHP and Encoding

This is a discussion on MySql, PHP and Encoding within the MySQL forums, part of the Database Server Software category; --> 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 ...


Go Back   Unix Technical Forum > Database Server Software > MySQL

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-28-2008, 08:57 AM
Carlone
 
Posts: n/a
Default MySql, PHP 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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-28-2008, 08:57 AM
Jerry Stuckle
 
Posts: n/a
Default Re: MySql, PHP and Encoding

Carlone wrote:
> 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@attglobal.net
==================
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-28-2008, 08:57 AM
Carlone
 
Posts: n/a
Default Re: MySql, PHP and Encoding

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?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 02-28-2008, 08:58 AM
Paul Lautman
 
Posts: n/a
Default Re: MySql, PHP and Encoding

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


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 02-28-2008, 08:58 AM
Carlone
 
Posts: n/a
Default Re: MySql, PHP and Encoding

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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 02-28-2008, 08:58 AM
Jerry Stuckle
 
Posts: n/a
Default Re: MySql, PHP and Encoding

Carlone wrote:
> 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@attglobal.net
==================
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
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
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 04:13 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com