Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

simpletemplate doesn't detect tokens containing utf8 chars

#93

When including a utf8 string in a spt file, like {intl Français}, it isn't detected by the simple template parser.

Reported by Charles Brunet · December 28th, 2008 @ 03:27 PM

State: resolved
Milestone: 5.0.3
Assigned to: Charles Brunet Charles Brunet

Activity

  1. lux
    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.

    January 4th, 2009 @ 02:35 PM

  2. Charles Brunet
    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'

    January 8th, 2009 @ 04:15 PM

  3. Charles Brunet
    Charles Brunet
    • State changed from new to resolved
    • Assigned user changed from lux to Charles Brunet

    July 24th, 2009 @ 12:03 PM

  4. Charles Brunet
    Charles Brunet
    • Milestone set to 5.0.3

    [milestone:id#47011 bulk edit command]

    August 7th, 2009 @ 09:41 AM

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.