Re: html entities

From: Date: Thu, 03 Mar 2005 21:34:49 +0000
Subject: Re: html entities
References: 1 2  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-17825@lists.php.net to get a copy of this message
On Thu, 3 Mar 2005 11:45:29 -0800 (PST), fluidliq@yahoo.com <fluidliq@yahoo.com> wrote: > The values are stored in the db in a blob type field. So I assume it > is stored in its own character. It is fine when displaying on ordinary > pages. It just doesn't show the characters when I want it to display as > values of the text elements of QuickForm. And now I want it to show the > characters as the values of the text elements instead of the HTML entities. > How should I do that? > > For now I have something like this in my HTML source when displayed... > <input > value="&amp;#21512;&amp;#24029;&amp;#33738;&amp;#33457;&amp;#39770;" > name="textname]" type="text" /> Well, this is your problem. The data is getting run through htmlentities (or similar) twice. Are you doing any kind of encoding yourself? Are you running htmlentities on the data at *any* time (submission, putting it in the DB, getting it from the DB, ouputting to QF, etc.)? How is this data put into the DB? It *looks* like the data in the DB has entities in it, which is probably not what you want. Try looking in the DB itself (using the command-line mysql client or something) and see if the entities are in there. > > I need to convert these HTML entities into its own characters in PEAR's QuickForm so that > the value of the text element shows the characters instead of the entities which users do not > understand. I tried html_entity_decode() function but it doesn't work. > > > Justin Patrin <papercrane@gmail.com> wrote: > On Thu, 3 Mar 2005 06:03:34 -0800 (PST), fluidliq@yahoo.com > wrote: > > I have a few quickform text elements which values are grabbed from the db. these values > > from the db are of asian characters. it has no problem showing up the characters in normal html text > > element. I guess PHP PEAR had converted the characters into HTML entities like 21335;"û before > > displaying it. > > Now, how do I convert them to their actual characters and display them as the value of the > > text elements? > > i had something like this now... > > $form->addElement("text", "txtName", "Name", > > array("value" => html_entity_decode($rows['name'])); > > but this doesn't work. > > > > please help me > > > > Are these stored in the DB as the actual Asian characters or the HTML > Entities? They should (IMHO) be stored as the actual chars. > > When QF displays the values it will use HTML entities because this is > the right way to display them. When they're submitted they should be > actual Asian characters again and not entities. You shouldn't have to > do any encoding or decoding. > > -- > Justin Patrin > -- Justin Patrin

« previous php.pear.general (#17825) next »