Mysql-连接如何设置能够将阿拉伯语文本插入数据库

this is the config.php

<? 
define('DB_SERVER', 'loalhost');
define('DB_USER', 'root');
define('DB_PASS', 'pass');
define('DB_NAME', 'dbname');
define('mysql_set_charset','utf8');
define('mysql_query','SET NAMES utf8_persian_ci');

?

when i insert arabic or persian text into database the formate changes. how i can keep the text in database as same formate of insert.

regards

You need to ensure the character set is correct throughout your database. This means checking all 3 layers, database, table and column. Using utf8 & utf8_general_ci will work for your arabic and persian text.

The below queries can be used to check the character set on each of the objects in your database, you can also check and change them easily in most GUI apps as well.

Column

SELECT character_set_name 
FROM information_schema.COLUMNS
WHERE table_schema = "YOUR_SCHEMA"
  AND table_name = "YOUR_TABLE"
  AND column_name = "YOUR_COLUMN";

Table

SELECT collations.character_set_name 
FROM information_schema.TABLES AS tables,
  information_schema.COLLATION_CHARACTER_SET_APPLICABILITY AS collations
WHERE collations.collation_name = tables.table_collation
  AND tables.table_schema = "YOUR_SCHEMA"
  AND tables.table_name = "YOUR_TABLE";

Database (Schema)

SELECT default_character_set_name 
FROM information_schema.SCHEMATA
WHERE schema_name = "YOUR_SCHEMA";