Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

html tag and encoding

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
gotsmarty
Smarty Rookie


Joined: 15 May 2007
Posts: 8

PostPosted: Thu Jun 05, 2014 11:04 am    Post subject: html tag and encoding Reply with quote

Hi there,

I have notice a really strange behaviour in Smarty (3)
When i assign a string variable to the template, with some html tag, the (utf8) encoding fail in the template.

for example:

wtih
$smarty->assign('test', "déjà bonjour <br>");
the {$test} variable in template display:
déjà bonjour <br>

if I change the <br> to <br/> or <br />, it's ok (déjà bonjour)

The same problem occured with <div>, <a> and <table> tag......

An idea?
Back to top
View user's profile Send private message
U.Tews
Administrator


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

PostPosted: Thu Jun 05, 2014 3:08 pm    Post subject: Reply with quote

Did you set your browser to utf-8 charset with a meta tag?

Code:
<meta http-equiv="Content-type" content="text/html; charset=UTF-8" />
Back to top
View user's profile Send private message
gotsmarty
Smarty Rookie


Joined: 15 May 2007
Posts: 8

PostPosted: Thu Jun 05, 2014 3:17 pm    Post subject: Reply with quote

yes, absolutely.
And as I said, it works in general.
The issue only occured when the string variable contain some of html tags (<br>,<div>,..)
(note that it is working with some others (<span>, <b>, <br />,....)
Back to top
View user's profile Send private message
gotsmarty
Smarty Rookie


Joined: 15 May 2007
Posts: 8

PostPosted: Thu Jun 05, 2014 4:01 pm    Post subject: Reply with quote

oops!
sorry I found the solution.
And the problem was not in Smarty engine but in a custom function that I didn't even know the existence

Thanks for support
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General 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