Forum Moderators: open

Message Too Old, No Replies

XHTML Validation and unicode

Dynamic text from database and unicodeing

         

vsgill

5:24 am on Apr 4, 2008 (gmt 0)

10+ Year Member



Hi Everyone

I am pulling some text from the database that has "&" in it..
When i validate my page i get the following error.


character "&" is the first character of a delimiter but occurred as data.

Any trick to get this page validated?
or will i have to change my text in database from
"&" to "&" ?

thanks
Vik

surrealillusions

11:05 am on Apr 4, 2008 (gmt 0)

10+ Year Member



How are you putting text into the database?

If its been submitted via a form, then you can change any &'s to & to ensure your code is validated.

:)

penders

1:38 pm on Apr 4, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



How are you putting text into the database?

I would have thought you would still want to store the "&" (rather than "&") in your database - if you later want to do any string comparison for instance? IMHO the "&" should only be converted to "&" prior to display in an HTML page. "&" is an 'HTML' entity afterall.

If using PHP, then you could call htmlspecialchars() [uk.php.net] or htmlentities() [uk.php.net] prior to outputting your page.

vsgill

8:44 pm on Apr 6, 2008 (gmt 0)

10+ Year Member



thanks for the reply...

>>How are you putting text into the database?
This is just a test database so i just entered it my self rite in the database...

I am using jsp.. is there any thing in jsp i can use?
thanks again