0

I have users inserting comments for their courses, and I save them on SQL like this:

$return = $_POST;
$x = $return["comment1"];

$result = "UPDATE  Students SET  `Comment1` =  '$x' WHERE  StudEmail = '$email'  ";

My question is the following: since they are italian, they use letters like: ò,à,ù,è. When SQL saves them, it doesn't recognise them. And obviously, when I print out those comments, it will print them out with a weird symbol.

Any advice?

Example: Comment: Mi è piaciuto SQL saves: Mi � piaciuto

Fidelio
  • 174
  • 12
  • And please, please, please learn to use prepared statements/bind variables before SQL injection strikes, or you have a comment containing an apostrophe (whichever is sooner) – Mark Baker Dec 01 '15 at 16:29

1 Answers1

0

You would have to search for those chars and replace them with the appropriate ascii value.

This link should help you find the values

http://www.ascii.cl/htmlcodes.htm

For example:

Letter è equals to è

Hope this helps.

Lino
  • 19,604
  • 6
  • 47
  • 65