Re: html entities

From: Date: Sat, 05 Mar 2005 03:43:52 +0000
Subject: Re: html entities
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-17856@lists.php.net to get a copy of this message
On Fri, 4 Mar 2005 19:40:39 -0800 (PST), fluidliqatyahoodotcom <fluidliq@yahoo.com> wrote: > I checked my HTML, and I realise what's going on. Ok here, the "&" are > displayed as "&amp;". The character "&" is also converted into its html > entities. This is the reason why it couldn't show up its characters. > Here's an example of what is displayed in the HTML: > "&amp;#27402;" > (without quotes) > it should be: > "&#27402" > (without quotes) This is exactly whatw e all have been telling you. The answer is *not to store it with the entities*. It should be the normal chars in the DB, not HTML entities. However, if you really want to leave it that way, try running html_entity_decode on the strings before you put them in QuickForm. > So now, my question is: Is there a way to stop PEAR from using htmlentities() or > htmlspecialchars() to its value? Stopping this from happening is not the right way to do it. > > Justin Patrin <papercrane@gmail.com> wrote:On Thu, 3 Mar 2005 19:00:25 -0800 (PST), > fluidliqatyahoodotcom > wrote: > > The data in the db now is in binary since the data type of the field is blob. > > Does PEAR convert the characters into HTML entities before processing it? > > The data type being blob has nothing to do with it. Look at the data > in the DB with a mysql frontend of some kind. Does it have entities or > the actual chars? > > If it has entities, then you inserted it into the DB with entities. > Figure out where that's happening. > > > > > Justin Patrin > wrote: > > On Thu, 3 Mar 2005 11:45:29 -0800 (PST), 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] > > > > 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 > > 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 > > > > -- > Justin Patrin > -- Justin Patrin

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