Re: [SMARTY] html_options problem

From: Date: Tue, 25 Mar 2003 15:42:09 +0000
Subject: Re: [SMARTY] html_options problem
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-8896@lists.php.net to get a copy of this message
On Tue, Mar 25, 2003 at 03:15:06PM +0000, Raul Carvalho wrote: > > Yes I have. > I tried several, actually: utf-8, PT, iso-8859-1 > > Note that all other data on the HTML is displaying correctly, because I use the html encoding > for these characters. The problem is with html_options that seems to converty every ampersand to its > html encoding, thus the browser only parses the ampersand.... sorry, i cannot reproduce this. when i call: echo smarty_function_html_options(array('options'=>array('foo'=>'ã é õ ó')), $smarty); i get: <option label="ã é õ ó" value="foo">ã é õ ó</option> > Thank you, > Raul > > > > Did you try setting the encoding of the HTML page being generated? > > > > <html> > > <head> > > <meta http-equiv="Content-Type" content="text/html; > > charset=utf-8" > > /> > > .... > > > > > > > > -----Original Message----- > > From: Raul Carvalho [mailto:raul.carvalho@prisma.pt] > > Sent: Tuesday, March 25, 2003 11:57 AM > > To: smarty-general@lists.php.net > > Subject: Re: [SMARTY] html_options problem > > > > > > Hello again, > > > > I think I am passing them correctly... > > I fetch the data from a mysql database using the Pear::DB abstraction > > layer so I end up havind 2 arrays of data, one containing the key and > > the other one the data to present on the combo-box. > > > > Here's a case: > > > > Mysql table: "table_a" > > > > id | name > > ---------- > > 1 | á > > 2 | Á > > 3 | Õ > > > > index.php: > > > > $res = $db->query("select id, name from table_a"); > > $i = 0; > > while ($row = $res->fetchRow()) { > > $id[$i] = $row->id; > > $name[$i] = $row->name; > > }; > > > > I then process this arrays in a smarty template, similar to this: > > > > index.tpl: > > > > <select name="xpto"> > > {html_options values=$id output=$name selected="1"}} > > </select> > > > > After printing to the browser, I get all characters mangled... i.e. the > > character "á" should be presented to browser like "&aacute;" but > > the > > ampersand itself is being encoded... and the browser displays > > "&amp;aacute;" instead! > > > > Am I doing something wrong? > > > > > On Tue, Mar 25, 2003 at 12:40:19PM +0000, Raul Carvalho wrote: > > > > Hello, > > > > > > > > I am trying to setup a select/option combo-box with values from a > > database. > > > > These values sometimes have portuguese characteres, like ã é õ ó > > etc... > > > > > > > > The problem is {html_options} is htmlencoding them in such a way > > that the browser cannot display them. For instance, the ã character > > should be converted to &atilde; but instead it is being converted to > > &amp;atilde; > > > > > > smarty_function_escape_special_chars() is designed to only escape > > > characters, that not have already been escaped. > > > > > > are you sure your data is passed correctly to html_options ? > > > > > > > > > > It seems I cannot control this behaviour and so far the solution is > > to build the options manually... > > > > > > > > Can someone help me? Is this a bug? > > > > > > > > -- > > > > Smarty General Mailing List (http://smarty.php.net/) > > > > To unsubscribe, visit: î>ÎcÎpj/™"0ï´(ÿ > > > > http://www.php.net/unsub.php > > > > > > -- > > > E-Commerce: Verkauft etwas, das mit elektrischem Strom funktioniert. > > (modern > > > für Multimedia) > > > Andreas > > Krennmair > > > > > > -- > > > Smarty General Mailing List (http://smarty.php.net/) > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > > > > > > > > -- > > Raul Carvalho > > PRISMA, S.A. > > > > -- > > Smarty General Mailing List (http://smarty.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > -- > > Smarty General Mailing List (http://smarty.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > > -- > Raul Carvalho > PRISMA, S.A. > > -- > Smarty General Mailing List (http://smarty.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -- It is essential that implementations by different vendors interoperate.: Unsere proprietären Basteleien dokumentieren wir gar nicht erst. Sven Türpe

« previous php.smarty.general (#8896) next »