Skip navigation links

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


Advanced Search

Re: Arabic text in mysql Varchar row
Posted by: Mark Webley ()
Date: September 08, 2011 04:45PM

Hello Rick

Thank you for your response.

For the query "HOW CREATE TABLE user" I see:

user | CREATE TABLE `user` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`company` text CHARACTER SET utf8 COLLATE utf8_unicode_ci,
`title` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
`description` longtext,
`country` varchar(255) NOT NULL DEFAULT '',
PRIMARY KEY (`id`,`country`)
) ENGINE=MyISAM AUTO_INCREMENT=253 DEFAULT CHARSET=utf8 |

I was reading some of the information on that link you mentioned previously,
I did a test and changed the PHP db insert for the 'title' and 'company'
with an example of Arabic text, the procedure insert uses utf8_encoding like:

"Call procedureName(\"". utf8_encode($title) . "\",
\"" . utf8_encode($company) . "\",
\"$description\")"

The 'description' text in the Database display normally as Arabic text without any like garbage looking text.

In the database the other column named 'text' the Arabic text insert looks like:
Ù? اÙ?خط فÙ? اÙ? فÙ? اÙ?خط فÙ? اÙ? فÙ? اÙ?خط

WHen I echo this back to the page for the title and company I it seams to look
better because I now echo with PHP's:

nl2br(utf8_decode($title))


but I get Square symbols and '?' mixed in with the Arabic text (but I am not
sure if the Arabic text is right) which is shown as:
�? ا�?خط ف�? ا�? ف�? ا�?خط ف�? ا�? ف�? ا�?خط
(Note: where it is cut and pasted above, you see "�" is where I see square symbols)


With the other column 'description' I do not have to do anything it works fine I just php echo nl2br($description) and it comes out great.


....do I have to change my.cnf somewhere on my Local HD?

I did a test from reading some of that link you sent above with:
SELECT title, HEX(title), LENGTH(title), CHAR_LENGTH(title) FROM ... WHERE ... LIMIT 1

and I see:

+----------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------+-----------------------+
| title | HEX(title) | LENGTH(title) | CHAR_LENGTH(title) |
+----------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------+-----------------------+
| Ù? اÙ?خط فÙ? اÙ? فÙ? اÙ?خط فÙ? اÙ? فÙ? اÙ?خط | C3993F20C398C2A7C3993FC398C2AEC398C2B720C399C281C3993F20C398C2A7C3993F20C399C281C3993F20C398C2A7C3993FC398C2AEC398C2B720C399C281C3993F20C398C2A7C3993F20C399C281C3993F20C398C2A7C3993FC398C2AEC398C2B720 | 100 | 60 |
+----------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------+-----------------------+


What do you think?...I will continue reading that link....


Thanks again...

Options: ReplyQuote


Subject Views Written By Posted
Arabic text in mysql Varchar row 6680 Mark Webley 09/05/2011 04:23PM
Re: Arabic text in mysql Varchar row 1795 Rick James 09/07/2011 08:01PM
Re: Arabic text in mysql Varchar row 2668 Mark Webley 09/08/2011 04:45PM
Re: Arabic text in mysql Varchar row 1656 Rick James 09/09/2011 06:46PM
Re: Arabic text in mysql Varchar row 2611 Mark Webley 09/11/2011 08:03AM
Re: Arabic text in mysql Varchar row 1497 Rick James 09/12/2011 11:30AM
Re: Arabic text in mysql Varchar row 2030 Mark Webley 09/12/2011 06:16PM
Re: Arabic text in mysql Varchar row 1365 Mark Webley 09/12/2011 06:17PM
Re: Arabic text in mysql Varchar row 1377 Rick James 09/13/2011 09:44PM
Re: Arabic text in mysql Varchar row 1736 Mark Webley 09/17/2011 05:53AM
Re: Arabic text in mysql Varchar row 1451 Rick James 09/18/2011 01:45PM
Re: Arabic text in mysql Varchar row 1492 Mark Webley 09/19/2011 04:10PM
Re: Arabic text in mysql Varchar row 1428 Rick James 09/20/2011 08:19PM
Re: Arabic text in mysql Varchar row 1647 Mark Webley 09/25/2011 12:09PM
Re: Arabic text in mysql Varchar row 1479 Rick James 09/28/2011 09:53PM
Re: Arabic text in mysql Varchar row 1422 Mark Webley 09/29/2011 02:44PM
Re: Arabic text in mysql Varchar row 2006 Rick James 09/30/2011 10:14AM
Re: Arabic text in mysql Varchar row 2090 Rick James 09/10/2011 03:07PM
Re: Arabic text in mysql Varchar row 2000 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.