Reply to Re: [PHP] Special HTML characters question.

Your name:

Reply:


Posted by Jay Paulson on 08/22/05 17:08

Thanks for the reply.

I would imagine there are a lot of special html characters that would
need to be changed using regex. Therefore, spending my time making a
regex to find a replace each one of them isn't a good way to spend my
time or even if I did go that route I'm sure it's uses too much system
resources to search for and replace all the characters. The reason I
say that is what if a user does a search on the database and the
database is filled with all these special characters. Sure I could
htmlspecialchars() the string that is passed to the search and then run
the sql to the DB for the query. However, does htmlspecialchars()
account for all special characters? Then you have to account for the
extra space the htmlspecialchars() is going to put in your DB and other
issues that might arise from that.

Does anyone know the common practice for this? Or is it just
preference?

Thanks,
jay

On Aug 22, 2005, at 8:42 AM, Jay Blanchard wrote:

> [snip]
> I have a problem that I'm sure some of you have run into before,
> therefore I hope you all know of an easy solution. Some of my users
> are cutting and pasting text from Word into text fields that are being
> saved into a database then from that database being displayed on a web
> page. The problem occurs when some special characters are being used.
> Double quotes, single quotes, and other characters like accents etc
> have the special html code like &quote; etc replacing the special
> characters. What methods are being used to combat this issue? Is
> there a solution out there to run text through some sort of filter
> before submitting it to the database to look for these special
> characters and then replacing them?
> [/snip]
>
> Start here http://www.php.net/htmlentities . You can also use any
> number
> of REGEX functions for replacing them http://www.php.net/regex
>
>

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация