Re: [PHPTAL] Hello, and PHPTAL probelm with UTF-8
On 31-08-2010 at 16:06:29 Robert Partyka 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
Re: [PHPTAL] Hello, and PHPTAL probelm with UTF-8
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. But... what if I need somewhere else UTF functions for str_replace and preg_* ? Is there way to force PHPTAL to work with mbstring ? regards, Robert ___ PHPTAL mailing list PHPTAL@lists.motion-twin.com http://lists.motion-twin.com/mailman/listinfo/phptal
Re: [PHPTAL] Hello, and PHPTAL probelm with UTF-8
W dniu 2010-08-31 12:37, Kornel Lesiński pisze: > > It does look like encoding-related issue, but I cannot reproduce it in > current version of PHP: Ok... it looks like some configuration problem. I can easly run it from command line but it fails when I't goes trought FastCGI. Now will need to find differences in conf regards, Robert ___ PHPTAL mailing list PHPTAL@lists.motion-twin.com http://lists.motion-twin.com/mailman/listinfo/phptal
Re: [PHPTAL] Hello, and PHPTAL probelm with UTF-8
On 31-08-2010 at 10:54:11 Robert Partyka wrote: I notice today strange problem with PHPTAL, when I start to use nederlands national characters in template. I get such error: Exception thrown while processing template From /var/www/test-nt/deny/files/index-main.html around line 34 exception 'PHPTAL_ParserException' with message 'Tag closure mismatch, expected < /div > (opened in line 34) but found < /iv> >' in /var/www/test-nt/deny/files/index-main.html:34 Stack trace: #0 /var/www/test-nt/deny/lib/PHPTAL/PHPTAL/Dom/SaxXmlParser.php(194): PHPTAL_Dom_DocumentBuilder->onElementClose('iv>') #1 /var/www/test-nt/deny/lib/PHPTAL/PHPTAL.php(1113): PHPTAL_Dom_SaxXmlParser->parseString(Object(PHPTAL_Dom_DocumentBuilder), 'parse() #3 /var/www/test-nt/deny/lib/PHPTAL/PHPTAL.php(651): PHPTAL->prepare() #4 /var/www/test-nt/index.php(62): PHPTAL->execute() #5 {main} Line which make error looks like this: Kopiëren van een rapport so the close tag is correct. Whole error disaperar when I change "ë" into "e". Template file is UTF-8 (no BOM). It does look like encoding-related issue, but I cannot reproduce it in current version of PHP: https://svn.motion-twin.com/phptal/trunk/tests/UTF8Test.php Perhaps specific bytes that cause the problem didn't survive copying via e-mail. Could you send me a file (preferably minimized test case) that causes the problem? You could also check out copy from SVN (https://svn.motion-twin.com/phptal/trunk), install PHPUnit (https://svn.motion-twin.com/phptal/trunk/README) and run `phpunit` in root of the working copy. Does your copy pass the tests? -- regards, Kornel ___ PHPTAL mailing list PHPTAL@lists.motion-twin.com http://lists.motion-twin.com/mailman/listinfo/phptal
Re: [PHPTAL] Hello, and PHPTAL probelm with UTF-8
Robert Partyka wrote: Line which make error looks like this: Kopiëren van een rapport so the close tag is correct. Whole error disaperar when I change "ë" into "e". Template file is UTF-8 (no BOM). someone know ansver what can be wrong? Maybe its something with configuration of PHP? PHP version - PHP 5.2.12 Hi, || That line works as expected for me. Perhaps you have| $phptal->setEncoding('ISO-8859-1')| or something like that in your code?|| ___ PHPTAL mailing list PHPTAL@lists.motion-twin.com http://lists.motion-twin.com/mailman/listinfo/phptal
Re: [PHPTAL] Hello, and PHPTAL probelm with UTF-8
Hello Robert, Am 31.08.2010 11:54, schrieb Robert Partyka: Hello, [...] someone know ansver what can be wrong? Maybe its something with configuration of PHP? PHP version - PHP 5.2.12 1. Are you very sure the file is utf-8 encoded? 2. IIRC some combination of PHP and/or libxml had strange errors in the recent past. Please check the output of phpversion() for the version of libxml you are using. If possible try the very same example on another machine with different php/libxml. Just a guess though. Greets and good luck, Peter ___ PHPTAL mailing list PHPTAL@lists.motion-twin.com http://lists.motion-twin.com/mailman/listinfo/phptal
[PHPTAL] Hello, and PHPTAL probelm with UTF-8
Hello, Hi for everyone on list. Short notice about me, because thats my first post here. My name is Robert, I'm php (and several other plangs) developer from Poland. In addition I'm involved in Polish Linux Users Group (in audit committee) and Polish Free and Open Software Fundation (experts advice). I notice today strange problem with PHPTAL, when I start to use nederlands national characters in template. I get such error: Exception thrown while processing template >From /var/www/test-nt/deny/files/index-main.html around line 34 exception 'PHPTAL_ParserException' with message 'Tag closure mismatch, expected < /div > (opened in line 34) but found < /iv> >' in /var/www/test-nt/deny/files/index-main.html:34 Stack trace: #0 /var/www/test-nt/deny/lib/PHPTAL/PHPTAL/Dom/SaxXmlParser.php(194): PHPTAL_Dom_DocumentBuilder->onElementClose('iv>') #1 /var/www/test-nt/deny/lib/PHPTAL/PHPTAL.php(1113): PHPTAL_Dom_SaxXmlParser->parseString(Object(PHPTAL_Dom_DocumentBuilder), 'parse() #3 /var/www/test-nt/deny/lib/PHPTAL/PHPTAL.php(651): PHPTAL->prepare() #4 /var/www/test-nt/index.php(62): PHPTAL->execute() #5 {main} Line which make error looks like this: Kopiëren van een rapport so the close tag is correct. Whole error disaperar when I change "ë" into "e". Template file is UTF-8 (no BOM). someone know ansver what can be wrong? Maybe its something with configuration of PHP? PHP version - PHP 5.2.12 regards, Robert ___ PHPTAL mailing list PHPTAL@lists.motion-twin.com http://lists.motion-twin.com/mailman/listinfo/phptal