[Phpmyadmin-devel] Re: japanese-sjis SQL-parser error

Robin Johnson robbat2 at orbis-terrarum.net
Tue Oct 8 11:13:05 CEST 2002


On Tue, Sep 24, 2002 at 12:29:35AM +0900, luc wrote:
> Please try to insert my attached texfile.
> I think to need new parser for multibyte character
> with using multibyte functions like mb_strlen().

Hi Luc and list.
Sorry about the delay, I've been really busy with university, exams and
work.

I have a rough preliminary fix for this inside just the SQL Parser, but it
made me realize that the same fix should probably be extended to the
rest of the system as well.

Problem summary:
PHP's string functions fail badly on strings containing multibyte (MB)
characters. This effects EVERY language that uses unicode or other
encoding schemes.

Solution:
Replace ALL string functions in the code (strlen, substr, strpos etc.)
with a variable $GLOBALS['PMA_MB_functionname'] that is then called.
Additionally to this, we have a little bit of code that puts the correct
function name in those variables, depending on the availability (PHP
version is important here) and the need for multibyte characaters. Eg
mb_strlen or strlen would go into $GLOBALS['PMA_MB_strlen'] which could
then be used in the code directly, and handle everything properly.

Any comments/suggetions/flames on this?

-- 
Robin Hugh Johnson
E-Mail     : robbat2 at orbis-terrarum.net
Home Page  : http://www.orbis-terrarum.net/?l=people.robbat2
ICQ#       : 30269588 or 41961639
GnuPG FP   : 11AC BA4F 4778 E3F6 E4ED  F38E B27B 944E 3488 4E85
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 232 bytes
Desc: not available
URL: <http://lists.phpmyadmin.net/pipermail/developers/attachments/20021008/7c3b5f35/attachment.sig>


More information about the Developers mailing list