Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.

Escape plugin crash with other charset

 
Post new topic   Reply to topic    Smarty Forum Index -> Smarty 3
View previous topic :: View next topic  
Author Message
Karel S.
Smarty Rookie


Joined: 03 Aug 2009
Posts: 26
Location: The Netherlands

PostPosted: Thu Aug 27, 2009 2:02 pm    Post subject: Escape plugin crash with other charset Reply with quote

Hi,

Try this:

Code:

header ( 'Content-Type: text/html; charset=ISO-8859-15' );


Code:

$test = 'Mét (Dutch word)';

$smarty->assign ( 'test', $test );


Code:

{$test|escape}


Now, the output is an empty string. That's because the default charset for Smarty is UTF-8. I known, you can fix this by setting $smarty->resource_char_set to ISO-8859-15. And that works fine, but returning an empty string (when script charset <> Smarty charset) is not that handy for debugging. It took a while before we located the source of the problem.
Back to top
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Thu Aug 27, 2009 3:41 pm    Post subject: Reply with quote

Smarty can not know what string you have passed as charset at the header function. The only idea I have right now is to make $smarty->resource_char_set as master for the specificion.

Code:
header ( "Content-Type: text/html; charset=$smarty->resource_char_set" );
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> Smarty 3 All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP