On Apr 16, 2004, at 3:40 AM, Merlin wrote:
Hi there,
I am just validating html generated by a php page. There is an error which comes
up if ther is a dash in the content text. Those characters come out of a database.
Is there a command in php which is escaping those characters for valid html output?
Something like urlencode, but for text escaping all such signs?
Here is the error msg: non SGML character number 150 This is the text: normal – text
If the text is coming from a database, how did the invalid character get into the text in the first place? It sounds like the problem is with the original HTML editor, not with PHP. For example, the current version of Adobe GoLive still uses the invalid code – for an en dash (the valid code is –). A good reference chart for correct character entities is here -- <http://www.roselli.org/adrian/articles/character_charts.asp>.
You could set up str_replace() translations to correct invalid character entity codes before displaying.
-- Lowell Allen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php