2

I am using latest PHP and latest MySQL. I have tried htmlspecialchars and mysql_real_escape_string but it inserts ? instead of the special character. I am inserting into varchar and text type fields. Special language characters like őúáűăţşîâ but it maight be other languages' characters.

Ervin
  • 2,374
  • 4
  • 30
  • 44
  • What are you trying to insert?? – Naftali Dec 19 '11 at 22:18
  • 2
    Every character is special in its own way. – Ignacio Vazquez-Abrams Dec 19 '11 at 22:19
  • What character are you trying to insert... It sounds like a collation issue. http://dev.mysql.com/doc/refman/5.5/en/charset-charsets.html – Sparky Dec 19 '11 at 22:19
  • 3
    [The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!)](http://www.joelonsoftware.com/articles/Unicode.html) – Pekka Dec 19 '11 at 22:20
  • Possible duplicate of [Special characters in PHP / MySQL](http://stackoverflow.com/q/633762) – Pekka Dec 19 '11 at 22:21
  • i make *everything* utf8, and then all is well. –  Dec 19 '11 at 22:22
  • What encoding are you using for your MySQL table (UTF-8, etc.)? What encoding are you using for the data coming from PHP? – calvinf Dec 19 '11 at 22:23
  • What collation are you using for your tables and in what language is the text that you are trying to save it? – Max Dec 19 '11 at 22:28

1 Answers1

2

Check the default encoding for your server, your meta-tag encoding declaration, and your collation on your database and tables are. You may want to make sure that everything is set to UTF8 if you're going to have lots of language characters.

Ben D
  • 14,321
  • 3
  • 45
  • 59