On 31-08-2010 at 16:06:29 Robert Partyka <bob...@wdg.pl> wrote:

 W dniu 2010-08-31 13:07, Robert Partyka pisze:
Now will need to find differences in conf....
Ok... it looks like
mbstring.func_overload = 7

is destroying work of PHPTAL.

That's very destructive setting in general. I recommend against using it.

But... what if I need somewhere else UTF
functions for str_replace and preg_* ?

It doesn't work with preg. It only worked with ereg functions, which are deprecated.

Use /u modifier in preg (always works, regardless of mb*).

Single-byte string replacement functions are safe with UTF-8 (UTF-8 char is never substring of another UTF-8 char).

For strlen/substr/strtoupper, etc. use mb_-prefixed functions explicitly. Find'n'replace over your sourcecode should break less things than func_overload.

Is there way to force PHPTAL to work with mbstring ?

PHPTAL works fine with mbstring extension installed. The only problem is func_overload hack that changes semantics of string functions, but fails to change string subscript operator, causing bugs in correct PHP code.

You could edit Dom/SaxXmlParser.php and change all $str[xxx] to substr($str,xxx,1). I hope mb_substr has some clever optimisations, otherwise this could make parser very, very slow.

There might be other places suffering from func_overload hack, and it may be difficult to find them all, which is why I'd rather not support it.

--
regards, Kornel

_______________________________________________
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal

Reply via email to