Skip navigation links

MySQL Forums :: Full-Text Search :: Arabic text in mysql Varchar row


Advanced Search

Arabic text in mysql Varchar row
Posted by: Mark Webley ()
Date: September 05, 2011 04:23PM

Hello

Does anyone out there have any idea of how to solve the following:

I am inserting a 'title' and 'description' into mysql with the same single query for a tabled named 'user'. But the cell named 'title' set as varchar(255) always comes out wrong.

I HAVE A TABLE ROW named 'description' as longtext
that WORKS perfectly FOR ARABIC TEXT (and I can see the Arabic text clearly in the database for this row)

BUT the other cell named 'title' in the same row VARCHAR(255) does not work....

For example for a cell named title with VARCHAR(255),
the Arabic text always comes out as ???????????? when I insert the data via php.

When I cut and past Arabic text straight into the database cell named 'title' using navicat...I see the Arabic text perfectly.

Just before the insert into mysql, I echo the query to the browser and the Arabic text looks perfect.

But it is still inserting garbage '????????????' into the database, but only for the cell named 'title'...for Arabic text.

On db connect I have:
self::$conn = new MySQLI(localhost, username, password, databasename);

// to help with arabic characters
self::$conn->query("SET CHARACTER SET 'utf8'");
self::$conn->query("SET NAMES utf8");

To test I did the msyql query below:
SHOW VARIABLES LIKE '%version%';
HOW VARIABLES LIKE '%version%';

and the results are:
+--------------------------+------------------------------+
| Variable_name | Value |
+--------------------------+------------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | latin1 |
| character_set_system | utf8 |
| character_sets_dir | \xampp\mysql\share\charsets\ |
| collation_connection | utf8_general_ci |
| collation_database | utf8_general_ci |
| collation_server | latin1_swedish_ci |
| completion_type | 0 |
| concurrent_insert | 1 |
| connect_timeout | 10 |
+--------------------------+------------------------------+
14 rows in set

+-------------------------+---------------------+
| Variable_name | Value |
+-------------------------+---------------------+
| protocol_version | 10 |
| version | 5.1.41 |
| version_comment | Source distribution |
| version_compile_machine | ia32 |
| version_compile_os | Win32 |
+-------------------------+---------------------+

the details of the table is described below after the below query:
describe user;

+------------------+--------------+------+-----+---------+-----------------------------+
| Field | Type | Null | Key | Default | Extra |
+------------------+--------------+------+-----+---------+-----------------------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| company | varchar(255) | YES | | NULL | |
| title | varchar(255) | YES | | NULL | ||
| description | longtext | YES | | NULL | |
+------------------+--------------+------+-----+---------+-----------------------------+


I am using XAMP on windows. PHP 5 and mysql version:

SHOW VARIABLES LIKE '%version%';
+-------------------------+---------------------+
| Variable_name | Value |
+-------------------------+---------------------+
| protocol_version | 10 |
| version | 5.1.41 |
| version_comment | Source distribution |
| version_compile_machine | ia32 |
| version_compile_os | Win32 |
+-------------------------+---------------------+


I spent more then 10 hours trying and testing and did PHP code tests with utf8_encoding() and utf8_decoding()...and only the Arabic text for 'title' is comes wrong...in my brower and also in the database, does anyone have any ideas...?

Thank you in advance... ?


Mark W
In Barcelona
www.adobeconsultant.co.uk

Options: ReplyQuote


Subject Views Written By Posted
Arabic text in mysql Varchar row 5327 Mark Webley 09/05/2011 04:23PM
Re: Arabic text in mysql Varchar row 1480 Rick James 09/07/2011 08:01PM
Re: Arabic text in mysql Varchar row 2201 Mark Webley 09/08/2011 04:45PM
Re: Arabic text in mysql Varchar row 1392 Rick James 09/09/2011 06:46PM
Re: Arabic text in mysql Varchar row 2067 Mark Webley 09/11/2011 08:03AM
Re: Arabic text in mysql Varchar row 1219 Rick James 09/12/2011 11:30AM
Re: Arabic text in mysql Varchar row 1766 Mark Webley 09/12/2011 06:16PM
Re: Arabic text in mysql Varchar row 1139 Mark Webley 09/12/2011 06:17PM
Re: Arabic text in mysql Varchar row 1141 Rick James 09/13/2011 09:44PM
Re: Arabic text in mysql Varchar row 1495 Mark Webley 09/17/2011 05:53AM
Re: Arabic text in mysql Varchar row 1216 Rick James 09/18/2011 01:45PM
Re: Arabic text in mysql Varchar row 1234 Mark Webley 09/19/2011 04:10PM
Re: Arabic text in mysql Varchar row 1188 Rick James 09/20/2011 08:19PM
Re: Arabic text in mysql Varchar row 1419 Mark Webley 09/25/2011 12:09PM
Re: Arabic text in mysql Varchar row 1226 Rick James 09/28/2011 09:53PM
Re: Arabic text in mysql Varchar row 1184 Mark Webley 09/29/2011 02:44PM
Re: Arabic text in mysql Varchar row 1732 Rick James 09/30/2011 10:14AM
Re: Arabic text in mysql Varchar row 1837 Rick James 09/10/2011 03:07PM
Re: Arabic text in mysql Varchar row 1718 Mark Webley 09/11/2011 08:01AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.