Re: [PHPTAL] Recommendation for the dynamic definition data encoding in source of template.
On 24-04-2009 at 08:19:41 CREATIVE0809 wrote: My site use several locales in the same time. Encoding can differ from user to user. UTF-8 would save you a lot of hassle. That's why i'm wrote this patch. I need simple way to set the encoding during script's execution, without reparse the template every time. It won't be reparsed every time - PHPTAL caches parsed templates, and will have separately cached copy for every encoding. In v1.1 you could get away with invalid encoding at compile time as long as you stayed away from Unicode, but in v1.2 I've fixed some bugs and added optimisations that rely on proper encoding being known at compile time. Please test 1.2.0 alpha and check if it works with your setup. -- regards, Kornel ___ PHPTAL mailing list PHPTAL@lists.motion-twin.com http://lists.motion-twin.com/mailman/listinfo/phptal
[PHPTAL] Recommendation for the dynamic definition data encoding in source of template.
> Thanks for the patch, however I'm not going to apply it, because it > introduces unnecessary runtime overhead, and doesn't solve the problem > entirely (there are other places which depend on encoding). > Instead I've made PHPTAL reparse the template whenever encoding is changed. > -- > regards, Kornel My site use several locales in the same time. Encoding can differ from user to user. That's why i'm wrote this patch. I need simple way to set the encoding during script's execution, without reparse the template every time. -- Tumanov Alexander ___ PHPTAL mailing list PHPTAL@lists.motion-twin.com http://lists.motion-twin.com/mailman/listinfo/phptal
Re: [PHPTAL] Recommendation for the dynamic definition data encoding in source of template.
On 23-04-2009 at 15:23:07 CREATIVE0809 wrote: --- a/State.php +++ b/State.php @@ -109,7 +109,7 @@ class PHPTAL_Php_State } private function _interpolateTalesVarsEscaped($matches) { -return 'ENT_QUOTES, \''.$this->_encoding.'\');?>'; +return 'ENT_QUOTES, $tpl->getEncoding());?>'; Thanks for the patch, however I'm not going to apply it, because it introduces unnecessary runtime overhead, and doesn't solve the problem entirely (there are other places which depend on encoding). Instead I've made PHPTAL reparse the template whenever encoding is changed. -- regards, Kornel ___ PHPTAL mailing list PHPTAL@lists.motion-twin.com http://lists.motion-twin.com/mailman/listinfo/phptal
[PHPTAL] Recommendation for the dynamic definition data encoding in source of template.
--- a/State.php +++ b/State.php @@ -109,7 +109,7 @@ class PHPTAL_Php_State } private function _interpolateTalesVarsEscaped($matches) { -return '_encoding.'\');?>'; +return 'getEncoding());?>'; } public function interpolateTalesVarsInHtml($src) @@ -140,7 +140,7 @@ class PHPTAL_Php_State public function htmlchars($php) { -return 'phptal_escape('.$php.', ENT_QUOTES, \''.$this->_encoding.'\')'; +return 'phptal_escape('.$php.', ENT_QUOTES, $tpl->getEncoding())'; } private $_debug; ___ PHPTAL mailing list PHPTAL@lists.motion-twin.com http://lists.motion-twin.com/mailman/listinfo/phptal