0

I am getting these chars as I insert into a database: “likeâ€. Its suppose to be "like" but it comes out that way.

It inserts into the database that way from a form I submit. I tried htmlspecialchars and addslashes but this did not work.

I am sure this is a simple fix. Just cant find it.

Thanks

UPDATE: I noticed that the funny chars come from the quotes that Microsoft Word makes. I used this code and it worked... for now.

$Comments = $_POST[Comments];
$Comments = str_replace("”", "\"", $Comments);
$Comments = str_replace("“", "\"", $Comments);
Papa De Beau
  • 3,744
  • 18
  • 79
  • 137

2 Answers2

3

You probably want to support Unicode characters throughout your app:

  1. Set your page encoding to UTF-8.
  2. Set your database connection to UTF-8 ("SET NAMES").
  3. Set your database storage encoding and collation to UTF-8
Matt S
  • 14,976
  • 6
  • 57
  • 76
0

Change your database encoding to UTF-8. This link could be helpful http://sudarmuthu.com/blog/wordpress-and-mysql-character-encoding

fasouto
  • 4,386
  • 3
  • 30
  • 66
  • I did your change in the database but it didn't work for the word quotes. See my post above. I updated it. That works for those but I don't know what other chars I might have issues with. – Papa De Beau Oct 13 '13 at 01:16
  • Ok, glad you solve it. BTW, I've found a similar thread in SO http://stackoverflow.com/a/12252899/263989 – fasouto Oct 13 '13 at 02:07