You are here: Advice needed; php5, utf-8, mb_* « PHP Programming Language « IT news, forums, messages
Advice needed; php5, utf-8, mb_*

Posted by working_boy on 08/14/07 09:26

Hello!

I am transferring large php application which also uses few third
party php libraries to UTF-8.

And now, of course I have problems with string functions which are not
multi-byte safe, especially in those third party libraries.

My first, optimistic attempt was to automatically override "ordinary"
string functions with its multi-byte versions
(.htaccess: php_value mbstring.func_overload 7).

But that didn't work out. For example phpmailer class failed.
Intrestingly enough it SEEMS that it works just fine with "ordinary"
string functions and UTF-8. But those bugs (which can be manifested
when using "ordinary" string functions with multi-bytes characters)
are note easy to catch especially when my primary language uses mostly
1byte characters.

So, for now only thing I can do is go through all third party
libraries and try to figure out which string functions are should work
on bytes and which should work on characters and replace them
accordingly.

For example, when strlen is supposed to return length in bytes I
should leave it as is, but when it's supposed to return number of
characters I should replace it with mb_strlen ... and so on for all
multi-byte unsafe string functions.

The problem is that it is not easy to find out which functions should
be replaced and which not, also I have to repeat the process each time
new version is released.


So, those anybody have any ideas how these problems can be solved more
elegantly?

Thx.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация