| 
	
 | 
 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] 
 |