1

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.

1
  • 1
    Using UTF-8 all the way through - on the page, in the data base, in the database connection - is the required first step. Are you doing that? (The second step for Arabic is dealing with Right-To-Left script, which I don't have much experience with, but all the necessary information should be available on Stack Overflow already.) Commented Nov 22, 2011 at 23:41

2 Answers 2

1

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'");
Sign up to request clarification or add additional context in comments.

1 Comment

Maybe this assist you: stackoverflow.com/questions/845418/hsqldb-table-encoding/… stackoverflow.com/questions/7501924/… But as Pekka I't know much about Arabic, Chinese and Russian characters.
0

Use UTF-8. Make sure your database collation is set to that (db, tables, and columns) and your php script also.

1 Comment

@FootieLegend, what seems to be the problem then? You say it's storing fine in the database. Is it not displaying back properly?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.