473,554 Members | 2,902 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1588
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*******@attgl obal.net
=============== ===
Jul 22 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
3370
by: apchar | last post by:
I am trying to use php as a kind of servlet to act as a middle man between a java applet and mysql. I know java has jdbc but it's flakey and painful. php access to mysql is much nicer. So I have: 1. An html page that holds the applet. 2. a php page that accepts data submitted to it by the applet via the $_POST array and writes it to the mysql...
8
5255
by: Bill Eldridge | last post by:
I'm trying to grab a document off the Web and toss it into a MySQL database, but I keep running into the various encoding problems with Unicode (that aren't a problem for me with GB2312, BIG 5, etc.) What I'd like is something as simple as: CREATE TABLE junk (junklet VARCHAR(2500) CHARACTER SET UTF8)); import MySQLdb, re,urllib
0
4549
by: Kenneth Illingsworth | last post by:
--=_603E7359.5B3A569C Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline I suspect that this is some kind of issue with privileges. However, the = account I am using has been given 'ALL' privileges to the database I am = trying to insert to. Am I save to assume that ALL...
0
2966
by: Kenneth Illingsworth | last post by:
--=_603E7359.5B3A569C Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline I suspect that this is some kind of issue with privileges. However, the = account I am using has been given 'ALL' privileges to the database I am = trying to insert to. Am I save to assume that ALL...
0
2745
by: Alcyone Oliveira | last post by:
------=_NextPart_000_000D_01C36572.F6480CE0 Content-Type: multipart/alternative; boundary="----=_NextPart_001_000E_01C36572.F6480CE0" ------=_NextPart_001_000E_01C36572.F6480CE0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
1
4837
by: jrs_14618 | last post by:
Hello All, This post is essentially a reply a previous post/thread here on this mailing.database.myodbc group titled: MySQL 4.0, FULL-TEXT Indexing and Search Arabic Data, Unicode I was wondering if anybody has experienced the same issues
11
11073
by: macca | last post by:
Hi, What should I be using for general MySQL database access? I've been using the traditional mysql extension for ages, but I'm trying to update my style to a more OOP paradigm. I've used PDO briefly but I've not used the mysqli extension yet. I've read a bit about it though, seems good and more OOP orientated (for the most part). But...
39
5830
by: alex | last post by:
I've converted a latin1 database I have to utf8. The process has been: # mysqldump -u root -p --default-character-set=latin1 -c --insert-ignore --skip-set-charset mydb mydb.sql # iconv -f ISO-8859-1 -t UTF-8 mydb.sql mydb_utf8.sql mysqlCREATE DATABASE mydb_utf8 CHARACTER SET utf8 COLLATE utf8_general_ci;
1
7541
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7872
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6123
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5423
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3545
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3533
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2006
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1114
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
823
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.