By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,303 Members | 1,260 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,303 IT Pros & Developers. It's quick & easy.

utf8

P: n/a
Hi,

I'm running php5 and mysql5, both configured for utf8... When I save
data into a table, and look at the table with e.g. phpmyadmin, the
data
has weird characters like: è and é in it.Actually this isn't a
big problem: when I print the data in my browser, the accents look
fine.

I read that when you execute a query "SET NAMES utf8", the weird chars
would disappear in the db, ...and still everything works fine.

So I tried to decode the utf8 data in my tables with using
utf8_decode... But it seems like it doesn't decode everything.

For example this doesn't work :echo utf8_decode('Problème la
sauvegarde des données.');

You will notice the isn't converted into an .

So I have 2 questions :

- should i use the SET NAMES query, or is it normal when you have
those
characters in your table
- how can I convert the into an

Thanks in advance!

Feb 22 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
I'm running php5 and mysql5, both configured for utf8... When I save
data into a table, and look at the table with e.g. phpmyadmin, the
data
has weird characters like: è and é in it.Actually this isn't a
big problem: when I print the data in my browser, the accents look
fine.
<snip>

I have burned my fingers a lot with encodings, lately. The problem is
that texts do have encodings, while strings do not. And off course, that
texts are stored as strings.

what you are seeing is utf-8, but shown as if it was latin-1 (or a
derivative). The reverse shows question marks, as most special
characters in latin-1 are not well formed utf-8.

I installed phpMyAdmin as well, because the site and the browser are now
working together just fine (IE and Firefox, at least), So any text gets
entered in utf-8 in the database and rendered the same as it was
entered. My hope was that phpMyAdmin would enable me to enter strings
directly into the database, as it is running inside a browser also. Bad
luck. Both phpMyAdmin and my regular database frontend show utf-8 as if
it is latin-1.

There is a lot that can go wrong:
- Your OS has an encoding
- The frontend program may have an encoding
- The database connection has an encoding
- The field has an encoding

There may be conversions at any point, but mostly texts are not
converted and I do not understand why you can give an encoding if it is
never used anyway.

Alas, there is no "unicode escape" either in MySQL (like "/Uxxxx" in
some languages). So it is impossible to store a query in a file, upload
it to another OS and have the encoding automagically set right. Some
encoding solutions are really laughable. Do you think that "SET NAMES
utf16le" will ever be executed? Only if it is a lie and NOT issued in
such an illegible encoding.

I am sorry that this is not very helpful, but I think I just need a
shoulder to cry on.

Wèèèèèèèèèèè !

--
Willem Bogaerts

Application smith
Kratz B.V.
http://www.kratz.nl/
Feb 23 '07 #2

P: n/a
ge***********@gmail.com wrote:
Hi,

I'm running php5 and mysql5, both configured for utf8... When I save
data into a table, and look at the table with e.g. phpmyadmin, the
data
has weird characters like: è and é in it.Actually this isn't a
big problem: when I print the data in my browser, the accents look
fine.

I read that when you execute a query "SET NAMES utf8", the weird chars
would disappear in the db, ...and still everything works fine.

So I tried to decode the utf8 data in my tables with using
utf8_decode... But it seems like it doesn't decode everything.

For example this doesn't work :echo utf8_decode('Problème la
sauvegarde des données.');

You will notice the isn't converted into an .

So I have 2 questions :

- should i use the SET NAMES query, or is it normal when you have
those
characters in your table
- how can I convert the into an

Thanks in advance!
You might want to have a look here for some more information:
http://adviesenzo.nl/examples/php_mysql_charset_fix/
Feb 24 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.