Reputation: 422
I run a fantasy football management game and I'm in the process of adding multiple nationalities.
How can I set up PHP / MySQL to accept foreign characters (ALL TYPES). At the moment I'm trying to add Arabic but I'm not having much luck. Which encoding do I need to use and how do I make it work?
I've set both to UTF-8 unicode Please see here: http://www.footielegend.com/test/header.php
It stores it fine in the database.
Upvotes: 1
Views: 526
Reputation: 422
Figured it, I just needed to add this after I connect to the database:
mysql_query("SET character_set_results = 'utf8', character_set_client = 'utf8', character_set_connection = 'utf8', character_set_database = 'utf8', character_set_server = 'utf8'");
Upvotes: 1
Reputation: 2141
Use UTF-8. Make sure your database collation is set to that (db, tables, and columns) and your php script also.
Upvotes: 0