Reply to Re: How to convert ascii to text

Your name:

Reply:


Posted by pangea33 on 12/15/06 06:56

veg_all@yahoo.com wrote:
> I replace some user input with their ascii equivalent so they display
> on the webpage properly:
>
> $entry = preg_replace ( "/\'+/" , '&#39' , $entry);
> $entry = preg_replace ( "/\,+/" , '&#44' , $entry);
>
> I then need to email the data, however in email the ascii code is
> displayed, not the text.
> Is there an easier way to convert the ascii back to the text without
> another preg_replace?

There really doesn't seem to be any reason you have to manually escape
the string with a regular expression, then change it back. Especially
since you're only accounting for a small set of characters that might
have problems. Why not leave the variable exactly as entered by the
user, and just run it through the "htmlspecialchars()" function when
you want to display it on the page?

http://us2.php.net/manual/en/function.htmlspecialchars.php

[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

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