#93 ✓resolved
Charles Brunet

simpletemplate doesn't detect tokens containing utf8 chars

Reported by Charles Brunet | December 28th, 2008 @ 03:27 PM | in 5.0.3 (closed)

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

Comments and changes to this ticket

  • lux

    lux January 4th, 2009 @ 02:35 PM

    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

    Charles Brunet January 8th, 2009 @ 04:15 PM

    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

    Charles Brunet July 24th, 2009 @ 12:03 PM

    • State changed from “new” to “resolved”
    • Assigned user changed from “lux” to “Charles Brunet”
  • Charles Brunet

    Charles Brunet August 7th, 2009 @ 09:41 AM

    • Milestone set to 5.0.3

    [milestone:id#47011 bulk edit command]

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.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

The Sitellite web content management system.

People watching this ticket

Pages