Re: [SMARTY] html_options problem

From: Date: Tue, 25 Mar 2003 14:56:40 +0000
Subject: Re: [SMARTY] html_options problem
Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-8890@lists.php.net to get a copy of this message
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: 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.

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