simpletemplate doesn't detect tokens containing utf8 chars
-
lux
I've played around with adding the /u UTF-8 switch to the preg_split() that handles this pattern matching, but I haven't been able to get it to work well on my system without causing other issues. The line is #661 in the file saf/lib/Template/Simple.php if you want to try to solve it.
-
Charles Brunet
Here is my analyse:
Actually, the regexp catches some specific characters delimited by a specific delimiter. So all chars that aren't in specified intervals aren't catched. Accented chars, in utf-8 of latin1 or whatever encoding aren't catched.
I don't think you need to use /u swich in preg_split because 1- you don't need to catch specific utf8 chars and 2- who said all files need to be utf8?
My first try was to catch any char except end delimiter. Then I realized that it catched css directives in some templates. The real solution would be not to have style tags in body oof html since it doesn't validate, but I contournated the problem by not catching cariage returns and line feeds. So the rule is: a simple template token cannot contains new line. It was already the case. So here is my regexp for line 661 of Template/Simple.php:
'/(' . $this->delim[$this->use_delim][0] . '[^\r\n' . $this->delim[$this->use_delim][1] . ']+' . $this->delim[$this->use_delim][1] . ')/s'
-
Charles Brunet
- State changed from new to resolved
- Assigned user changed from lux to Charles Brunet
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.