Forums / Developer / Validating xhtml problem with ezxml

Validating xhtml problem with ezxml

Author Message

Paul Forsyth

Monday 13 October 2003 8:13:13 am

Im working through some xhtml errors found when running my site through:

http://validator.w3.org

and im down to just one error now on the front page. :)

I have an xml field containing a sentence with an apostrophe. The validator doesn't like the output and states this:

Line 178, column 163: non SGML character number 146 (explain...).

...rch solutions tailored to each client’s needs.

Although the apostrophe is displayed correctly in the browser i can't seem to get the validator to like it. My page settings seem fine, encoding is iso-8859-1, etc, and the xml within the db seems ok.

Any ideas?

Paul

Alex Jones

Monday 13 October 2003 8:23:19 am

I believe $#146; is not a standard code. I believe it should be ’

Alex

Alex
[ bald_technologist on the IRC channel (irc.freenode.net): #eZpublish ]

<i>When in doubt, clear the cache.</i>

Paul Forsyth

Monday 13 October 2003 8:29:17 am

From this page:

http://www.w3.org/MarkUp/html3/latin1.html

&39; seems right.

But, why is the ezxml producing this encoding in the first place?

paul

Alex Jones

Monday 13 October 2003 8:34:58 am

Yeah, &#39; should do the trick for a simple apostrophe. Out of curiosity, this isn't from text pasted from Word or the like, is it?

Alex

Alex
[ bald_technologist on the IRC channel (irc.freenode.net): #eZpublish ]

<i>When in doubt, clear the cache.</i>

Paul Forsyth

Monday 13 October 2003 8:40:30 am

Yes!

It was pasted in from a copy document i was given.... It was from openoffice but the original doc might have been word ;)

Excellent, i now get:

This Page Is Valid XHTML 1.0 Transitional!

on the validator :)

Out of curiosity is there a way to safely convert characters like this. Working from copy documents is sometimes the only way i can remain sane. Is it a matter of ensuring the original document is itself using the right encoding?

thanks, alex!

paul

Alex Jones

Monday 13 October 2003 8:43:02 am

I don't know of a sure-fire way to do this, though a new wash item might do the trick. When I am worried about weird MS Word issues and the like I will often cut and paste the text into a plain-text editor first which will usually convert everything.

Alex

Alex
[ bald_technologist on the IRC channel (irc.freenode.net): #eZpublish ]

<i>When in doubt, clear the cache.</i>

Alex Jones

Monday 13 October 2003 8:46:43 am

Something along the line of the Word Cleaner at Textism may prove useful as well: http://www.textism.com/resources/cleanwordhtml/

Alex

Alex
[ bald_technologist on the IRC channel (irc.freenode.net): #eZpublish ]

<i>When in doubt, clear the cache.</i>

Paul Forsyth

Monday 13 October 2003 8:58:33 am

thanks,

lesson learnt.... :)

paul