linnewbie wrote: > On Apr 9, 1:00 pm, st...@blighty.com (Steve Atkins) wrote: >> On Apr 9, 2009, at 9:27 AM, linnewbie wrote: >> >>> Hi all, >>> I have stored HTML in a text field that I subsequently render on the >>> web. However when I retrieve and render this data on the web I am >>> getting the entities being rendered in their raw form, ie, instead of >>> getting the '&' symbol when '&' is stored I'm getting the 'raw' >>> '&'. >>> I would be grateful if anyone can point out how I can get around this. >> It's a problem in your code, not the database. You're probably >> escaping it one time to many or unescaping it one time too few. >> >> Cheers, >> Steve >> >> -- >> Sent via pgsql-general mailing list (pgsql-gene...@postgresql.org) >> To make changes to your >> subscription:http://www.postgresql.org/mailpref/pgsql-general > > To clarify, I am not escaping the string in any way. > > Say the page I am saving the database is the about us page form a > company website. > First, make a from to create the about us page in a text area field, > then I copy the > html from my text editor and past it ino this text area from. I then > have a cgi script which > takes the contents from the text area field and stores it in the > database. > > What I have on disk would be: > > ................................ > .............................. > <p> Bonnie & Clyde</p> > > which would usually be rendered as: > > Bonnie & Clype > > but this is not happening, it's being rendered > as: > > Bonnie & Clyde
That's because, as someone else suggested, something is quoting the &. In order to be rendered 'Bonnie & Clyde' by the browser, it needs to be 'Bonnie &amp; Clyde' in the HTML (just view the HTML source from inside the browser). You haven't provided any detail on the rendering phase, BTW. .TM. -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general