I m creating page in which user enters commnets and that comments are inserted into DB(mysql). These comments can contain single,double quotes or any special chars. To escape these I used following code
$str = mysql_real_escape_string($str,$conn);
here $conn is active connection resource, $str is string content from textarea
This works fine and return perfectly escaped string that I can insert into DB. But if user typed his/her comments into text editor like openoffice writer or msword and use this text from it, the error occur and gives error as follow while inserting in DB
Incorrect string value: '\x93testi...' for column 'commnets' at row 1
I think this is happening because single-double quotes in text that are coming from text editor(openoffice, msword) is not escaped properly. So How do I escape it to insert it into DB. Please help me
Thanks in advance.....