Re: [SMARTY] Smarty and Unicode

Marcus Bointon <[email protected]>
Newsgroups gmane.comp.php.smarty.general
Message-ID <[email protected]>
On 1 Mar 2006, at 08:53, Vicente Werner wrote:

> Yes, but what I was referring to in my email to Marcus was that if the
> variable contents you need to modify were UTF-8 strings you might  
> get very
> strange results since php regex will treat that utf-8 string like  
> an ASCII
> one.

I only really see a potential problem with modifiers. As Boots said,  
as long as Smarty treats stuff inside and outside the delimiters  
consistently, Unicode's ASCII compatibility should just let it work  
transparently.

I've done some experiments and it does indeed 'just work' - getting  
stuff in and out of the DB is similarly transparent (and yes I am  
using mysql_real_escape_string!). It's safe to have UTF-8 templates,  
though it seems sensible to keep scripts as iso-8859-1 (though it  
also worked as UTF-8, including literal unicode text in strings).

I've no particular need to use UTF-8 variable or file names, so I'm  
happy to simply avoid that issue.

It seems I 'only' need to pay attention to modifiers and validation  
functions (strlen, trim and friends). It might be a good opportunity  
to make my validation more modular so that when PHP 6 comes along I  
can swap it all out easily.

> That issue has made me turn my back on PHP until version 6, where  
> it'll be
> solved -I hope, unless zend gets a new stupid idea again and  
> decides to put
> the effort in adding better support for .net, or anythin' like that-

While I agree that PHP should probably have sorted this one out  
earlier, I have a fairly large codebase and can't afford to switch  
environments now. Plus there's too much other good stuff in PHP ;^)

Thanks for all your help,

Marcus
-- 
Marcus Bointon
Synchromedia Limited: Putting you in the picture
[email protected] | http://www.synchromedia.co.uk

-- 
Smarty General Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.