Page 1 of 1

Apoostrophes in textarea

Posted: Mon Oct 04, 2010 7:58 am
by kdidymus
Long story short, part of the site I'm designing takes input from the user in the form of a textarea and posts the inputted text to a MySQL table.

When you SELECT the data back from the dB, apostrophes are being slashed out (i.e. Wouldn/'t instead of wouldn't) and I don't know how to stop it doing this. The same goes for the pound sterling symbol which is displayed as a square.

I know that the ASCII code for an apostrophe is ' and the ASCII code for a pound sterling symbol is £

Is there any way of having my PHP check the inputted text and convert any apostrophes or sterling symbols with their ASCII equivalent?

Thanks in advance.

Re: Apoostrophes in textarea

Posted: Mon Oct 04, 2010 9:13 am
by internet-solution
It looks magicquote is enabled on your server. The easiset thing is to use stripslashes on the data you are receiving from the database.

Re. £ symbol, you can do a preg_replace before inserting data into DB, to replace the £ with its ASCII equivalent.