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 — and – don't work in older browsers (like NN4), so best use the numeric entities:


                 em-dash => —
                 en-dash => –
  elispes (not epsilons) => …
                   "foo" => “foo”
                   'bah' => ‘bah’

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/
*****************************************************




Reply via email to