Storing special characters in database
Posted: Wed Sep 23, 2009 3:38 am
Hi all,
I've built a simple script that allows a user to create an email which is inserted into a pre-built html template to create a nice looking email.
I have created a form that the user enters the email text, uploads an image etc. However, the problem arises when I try to extract the text from the database and place it into the template. It looks fine when I preview the email with the text inserted, but once this is sent out to the mailing list it doesn't look right. £ (pound) signs are replaced with unrecognisable characters, single quotes have backslashes etc etc.
I've tried things like strip_slashes that work to some extent, but I was wondering if there is a function that can deal with all special characters (such as double/single quotes, pound signs etc) and manipulate them for storage in the database and then 'un' manipulate them when they are extracted from the database and placed in the email template?
Thanks in advance
I've built a simple script that allows a user to create an email which is inserted into a pre-built html template to create a nice looking email.
I have created a form that the user enters the email text, uploads an image etc. However, the problem arises when I try to extract the text from the database and place it into the template. It looks fine when I preview the email with the text inserted, but once this is sent out to the mailing list it doesn't look right. £ (pound) signs are replaced with unrecognisable characters, single quotes have backslashes etc etc.
I've tried things like strip_slashes that work to some extent, but I was wondering if there is a function that can deal with all special characters (such as double/single quotes, pound signs etc) and manipulate them for storage in the database and then 'un' manipulate them when they are extracted from the database and placed in the email template?
Thanks in advance