For Programmers: Free Programming Magazines  


Home > Archive > PHP SQL > February 2006 > Re: phpMyAdmin : convcharset, utf8 and iso-8859-15









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: phpMyAdmin : convcharset, utf8 and iso-8859-15
Jim Michaels

2006-02-24, 3:56 am


"CapitaineEcarlate" <bonnepluie@free.fr> wrote in message
news:43959b76$0$4344$626a54ce@news.free.fr...
> Hy,
>
> My website is hosted by Free.fr which offers MySQL control via phpMyAdmin
> 2.6.3-pl1. That's great, but i have a little problem.
>
> To follow the current stream and because my website is intended to be in
> several languages, i decided to use utf8 encoding instead of iso-8859-15.
> Everything works fine : the tables are in utf8, and PHP handle it... But,
> phpMyAdmin seems to systematically convert data from the Insert forms in
> iso-8859-1 before the table to be fed. I foud in the source of the Insert
> page :
> <input type="hidden" name="convcharset" value="iso-8859-1" />
> And, all text data is actually stored as iso instead of utf8.
>
> If i do my own form to feed the table with correct utf8 data, i don't
> encounter any problem. If i use the utf8_encode() PHP function, it fixes
> the problem too. But... i'd like to feed the table with the help of
> phpMyAdmin, but in true utf8.
>
> Note that Free.fr offers MySQL 4.1.13.
>
> Any idea ?
> Do you know if it is an option of phpMyAdmin ?


not in the manual.

> Thanks !
>
> CapitaineEcarlate


Maybe I am not the one to be speaking (since I haven't looked inside
phpMyAdmin), but I don't think the problem is phpMyAdmin. utf-8 is a binary
stream. so the fields you use with it should be MySQL types like
VARBINARY() or BLOB() or TINYBLOB or MEDIUMBLOB.
as binary data, it should be hexcoded, or at least fed through addslashes()
before it ends up being fed to the db, or use the mysqli functions
[including mysqli_prepare()] and variable binding. I don't know what will
happen if a utf-8 stream ends up in SQL statements as table names. There is
a chance one of those bytes might happen to be a quote character. SQL is
ANSI, not utf-8 coded.

The problem you are having is not how do I put utf-8 text in, but instead,
how do I put a binary stream of data into a text field in phpMyAdmin. The
answer is, of course, you do a workaround. phpMyAdmin's text fields were
made to work with text, not binary data such as utf-8. that's the area you
are going to have to modify of course.


Jim Michaels

2006-02-24, 9:56 pm


"Jim Michaels" <NOSPAMFORjmichae3@yahoo.com> wrote in message
news:zu2dnbK4KtPIPmPenZ2dneKdnZydnZ2d@co
mcast.com...
>
> "CapitaineEcarlate" <bonnepluie@free.fr> wrote in message
> news:43959b76$0$4344$626a54ce@news.free.fr...

in PHPMyAdmin you can set the collation (charset), but you are limited to
what tthe database can handle. you can set a specific language, but that
doesn't include utf-8. I looked in MySQL's share directory.
[color=darkred]
>
> not in the manual.
>
>
> Maybe I am not the one to be speaking (since I haven't looked inside
> phpMyAdmin), but I don't think the problem is phpMyAdmin. utf-8 is a
> binary stream. so the fields you use with it should be MySQL types like
> VARBINARY() or BLOB() or TINYBLOB or MEDIUMBLOB.
> as binary data, it should be hexcoded, or at least fed through
> addslashes() before it ends up being fed to the db, or use the mysqli
> functions [including mysqli_prepare()] and variable binding. I don't know
> what will happen if a utf-8 stream ends up in SQL statements as table
> names. There is a chance one of those bytes might happen to be a quote
> character. SQL is ANSI, not utf-8 coded.
>
> The problem you are having is not how do I put utf-8 text in, but instead,
> how do I put a binary stream of data into a text field in phpMyAdmin. The
> answer is, of course, you do a workaround. phpMyAdmin's text fields were
> made to work with text, not binary data such as utf-8. that's the area
> you are going to have to modify of course.
>



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com