detecting special characters

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
localhost
Forum Commoner
Posts: 43
Joined: Tue Dec 07, 2004 4:52 am
Location: islamabad
Contact:

detecting special characters

Post by localhost »

while uploading a file if there is an specail character in it like " ' " how can i save the file with these special characters
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

you are already saving it.......

if you save it in a database, you probably need to escape it... mysql has for example [php_man]mysql_escape_string[/php_man]

if you want to output it again, you probably need to [php_man]stripslashes[/php_man] first as they were added by mysql_Escape_string..

and as you already know, html doesn't display \r\n as a newline... but wants <br> for that... to accomplish this, you need [php_man]htmlentities[/php_man]
Post Reply