1

Possible Duplicate:
UTF-8 all the way through

i want ti have fully unicode database via mysql. i hear about using SET NAMES 'utf8' is not good for some SQL injection issue.

what's the best usage mysql for fully unicode support.

Community
  • 1
  • 1

1 Answers1

2

We often use utf8_general_ci as table collation in mysql databases. It's faster but it is considered a legacy collation. The mysql documentation recommends utf8_unicode_ci for most precise character resolution. As for the sql injection: you need to escape with mysql_real_escape_string() instead of addslashes(), the latter won't prevent sql injection in unicode tables.

Chris
  • 322
  • 1
  • 3
  • 1
    ... or even better, use PDO with parametrized queries instead of the old `mysql_*` functions. – Pekka Aug 04 '12 at 21:53