RE: [WSG] Problem Validating CSS
Hi Chris, You need to escape any with amp;(even in URL query strings). Links to the relevant files/validator results would help so we could see the code. P From: Chris Stratford [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 11, 2004 1:01 PMTo: Web Standards GroupSubject: [WSG] Problem Validating CSS I have an interesting problem here...i try and validate the CSS of my XHTML website...and the CSS page says i must validate my XHTML first...The problem is that the XHTML is actually 100% Valid.It has a problem with the '' symbol??What is causing this problem?I mean - why doesn't the CSS Validate, but the XHTML does...Thanks for any help!-- Chris Stratford [EMAIL PROTECTED] Http://www.neester.com* The discussion list for http://webstandardsgroup.org/ *
RE: [WSG] Problem Validating CSS
The other suggestion is to validate the CSS file(s) separately at http://jigsaw.w3.org/css-validator/validator-uri.htmlrather than parsing the xhtml for the linked files. P I have an interesting problem here...i try and validate the CSS of my XHTML website...and the CSS page says i must validate my XHTML first...The problem is that the XHTML is actually 100% Valid.It has a problem with the '' symbol??What is causing this problem?I mean - why doesn't the CSS Validate, but the XHTML does...Thanks for any help! -- Chris Stratford [EMAIL PROTECTED] Http://www.neester.com
RE: [WSG] Problem Validating CSS
It's good practice to do it for (amp;) and (quot;) in the text all the time (HTML or XHTML). Also be aware of em-dashes, en-dashes, epsilons (...) and the curly varieties of and ' (which I hate and always strip back to the plain text version). If it's your own blog software, make sure to replace them as you output the formatted text. I'm sure there's a PHP function (?) that does this conversion on a string for you. Not wanting to go OT here but in CF I generally run this function over all inputs to a content database: function InputClean(string) { returnstring = Trim(string); returnstring = Replace(returnstring, '-', '-', 'all'); returnstring = Replace(returnstring, '-', '-', 'all'); returnstring = Replace(returnstring, '.', '...', 'all'); returnstring = Replace(returnstring, '', '', 'all'); returnstring = Replace(returnstring, '', '', 'all'); returnstring = Replace(returnstring, ', ', all); returnstring = Replace(returnstring, ', ', all); return returnstring; } And this one on output to the page function OutputFormat(string) { returnstring = Trim(string); returnstring = Replace(returnstring, '', 'amp;', 'all'); returnstring = Replace(returnstring, '', 'quot;', 'all'); return returnstring; } As mentioned before, also make sure you do it if you're dynamicly building URLs with a querystring (e.g. /blog.php?id=#something#amp;method=#somethingelse#) Sorry, I don't do PHP. Someone else may have a PHP solution for you. P Its an in text, not in a URL or anything - I didn't realise this posed a problem. :( * The discussion list for http://webstandardsgroup.org/ *
RE: [WSG] Problem Validating CSS
not wanting to add to your OT, but you will find that #htmlEditFormat(string)# works better for most cases ;-)) Taco Fleur 07 3535 5072 Blog: http://www.tacofleur.com/index/blog/ Methodology: http://www.tacofleur.com/index/methodology/ Tell me and I will forget Show me and I will remember Teach me and I will learn -Original Message- From: Peter Firminger [mailto:[EMAIL PROTECTED] Sent: Wednesday, 11 February 2004 1:30 PM To: [EMAIL PROTECTED] Subject: RE: [WSG] Problem Validating CSS It's good practice to do it for (amp;) and (quot;) in the text all the time (HTML or XHTML). Also be aware of em-dashes, en-dashes, epsilons (...) and the curly varieties of and ' (which I hate and always strip back to the plain text version). If it's your own blog software, make sure to replace them as you output the formatted text. I'm sure there's a PHP function (?) that does this conversion on a string for you. Not wanting to go OT here but in CF I generally run this function over all inputs to a content database: function InputClean(string) { returnstring = Trim(string); returnstring = Replace(returnstring, '-', '-', 'all'); returnstring = Replace(returnstring, '-', '-', 'all'); returnstring = Replace(returnstring, '.', '...', 'all'); returnstring = Replace(returnstring, '', '', 'all'); returnstring = Replace(returnstring, '', '', 'all'); returnstring = Replace(returnstring, ', ', all); returnstring = Replace(returnstring, ', ', all); return returnstring; } And this one on output to the page function OutputFormat(string) { returnstring = Trim(string); returnstring = Replace(returnstring, '', 'amp;', 'all'); returnstring = Replace(returnstring, '', 'quot;', 'all'); return returnstring; } As mentioned before, also make sure you do it if you're dynamicly building URLs with a querystring (e.g. /blog.php?id=#something#amp;method=#somethingelse#) Sorry, I don't do PHP. Someone else may have a PHP solution for you. P Its an in text, not in a URL or anything - I didn't realise this posed a problem. :( * The discussion list for http://webstandardsgroup.org/ * * The discussion list for http://webstandardsgroup.org/ *
Re: [WSG] Problem Validating CSS
Peter Firminger wrote: Sorry, I don't do PHP. Someone else may have a PHP solution for you. P I think I did a pretty long post a while back on this subject - probably good to search for it in the archive. Anyway, the PHP way to do the CF in Peter's example is: $newString = htmlspecialchars($oldString); or $newString = htmlentities($oldString); The relevant core PHP functions are: htmlspecialchars htmlentities html_entity_decode get_html_translation_table If you are putting data into a data store it's wise to stripslashes(), strip_tags() and other characters that can cause problems. All available in the PHP manual at php.net/manual/ Cheers James * The discussion list for http://webstandardsgroup.org/ *
Re: [WSG] Problem Validating CSS
I beg of you, don't discard the 'curly varieties' - they are the typographical correct apostrophes. The non-curly versions are an ugly pox on mankind and should only be used to delineate feet and inches. Peter On 11/02/2004, at 2:30 PM, Peter Firminger wrote: Also be aware of em-dashes, en-dashes, epsilons (...) and the curly varieties of and ' (which I hate and always strip back to the plain text version). x-tad-bigger /x-tad-biggerUniversal Head Design That Works. 7/43 Bridge Rd Stanmore NSW 2048 Australia T (+612) 9517 1466 F (+612) 9565 4747 E [EMAIL PROTECTED] W www.universalhead.com
Re: [WSG] Problem Validating CSS
Thats great thanks! :) There are a whole bunch of PHP tags available to use... Thanks for that tho :) Your advice has helped me a lot :D cheers Pete! Chris Stratford [EMAIL PROTECTED] Http://www.neester.com Peter Firminger wrote: It's good practice to do it for (amp;) and " (quot;) in the text all the time (HTML or XHTML). Also be aware of em-dashes, en-dashes, epsilons (...) and the curly varieties of " and ' (which I hate and always strip back to the plain text version). If it's your own blog software, make sure to replace them as you output the formatted text. I'm sure there's a PHP function (?) that does this conversion on a string for you. Not wanting to go OT here but in CF I generally run this function over all inputs to a content database: function InputClean(string) { returnstring = Trim(string); returnstring = Replace(returnstring, '-', '-', 'all'); returnstring = Replace(returnstring, '-', '-', 'all'); returnstring = Replace(returnstring, '.', '...', 'all'); returnstring = Replace(returnstring, '"', '"', 'all'); returnstring = Replace(returnstring, '"', '"', 'all'); returnstring = Replace(returnstring, "'", "'", "all"); returnstring = Replace(returnstring, "'", "'", "all"); return returnstring; } And this one on output to the page function OutputFormat(string) { returnstring = Trim(string); returnstring = Replace(returnstring, '', 'amp;', 'all'); returnstring = Replace(returnstring, '"', 'quot;', 'all'); return returnstring; } As mentioned before, also make sure you do it if you're dynamicly building URLs with a querystring (e.g. "/blog.php?id=#something#amp;method=#somethingelse#") Sorry, I don't do PHP. Someone else may have a PHP solution for you. P Its an in text, not in a URL or anything - I didn't realise this posed a problem. :( * The discussion list for http://webstandardsgroup.org/ * * The discussion list for http://webstandardsgroup.org/ *
Re: [WSG] Problem Validating CSS
On Wednesday, February 11, 2004, at 02:30 PM, Peter Firminger wrote: Also be aware of em-dashes, en-dashes, epsilons (...) and the curly varieties of and ' (which I hate and always strip back to the plain text version). I've found that the entities mdash; and ndash; don't work in older browsers (like NN4), so best use the numeric entities: em-dash = #8212; en-dash = #8211; elispes (not epsilons) = #8230; foo = #8220;foo#8221; 'bah' = #8216;bah#8217; If it's your own blog software, make sure to replace them as you output the formatted text. I'm sure there's a PHP function (?) that does this conversion on a string for you. ?php echo htmlspecialchars($text); ? will take care of most of the above with entities (it won't perform educated quotes replacement), and is a great quick fix in PHP, but rolling your own replacement function will allow you to: a) skip some chars (like and if you want to allow tags b) use numeric references rather than entities If the OP needs further help, just ask... I've got plenty of functions to help with cleaning text, and prepping it for HTML output in PHP As mentioned before, also make sure you do it if you're dynamicly building URLs with a querystring (e.g. /blog.php?id=#something#amp;method=#somethingelse#) Sorry, I don't do PHP. Someone else may have a PHP solution for you. urlencode() will help there. Justin French * The discussion list for http://webstandardsgroup.org/ *
RE: [WSG] Problem Validating CSS
I've found that the entities mdash; and ndash; don't work in older browsers (like NN4), so best use the numeric entities: em-dash = #8212; en-dash = #8211; I agree entirely Justin. Sorry I didn't point that out. elispes (not epsilons) = #8230; Oops, how embarrassment! But I'd rather stick with 3 dots (...) as I have seen this one break badly in a search result or text browser or something, can't remember where now. May just be a stubborn bad habit. Sorry if that worries Peter (UH) as well. P * The discussion list for http://webstandardsgroup.org/ *
Re: [WSG] Problem Validating CSS
Naw, I can live with the three dot thing ;) P But I'd rather stick with 3 dots (...) as I have seen this one break badly in a search result or text browser or something, can't remember where now. May just be a stubborn bad habit. Sorry if that worries Peter (UH) as well. x-tad-bigger /x-tad-biggerUniversal Head Design That Works. 7/43 Bridge Rd Stanmore NSW 2048 Australia T (+612) 9517 1466 F (+612) 9565 4747 E [EMAIL PROTECTED] W www.universalhead.com