MySQL Forums
Forum List  »  Full-Text 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
14481
September 05, 2011 04:23PM
3719
September 07, 2011 08:01PM
Re: Arabic text in mysql Varchar row
5024
September 08, 2011 04:45PM
2968
September 09, 2011 06:46PM
4700
September 11, 2011 08:03AM
2782
September 12, 2011 11:30AM
3425
September 12, 2011 06:16PM
2592
September 12, 2011 06:17PM
2722
September 13, 2011 09:44PM
2996
September 17, 2011 05:53AM
2582
September 18, 2011 01:45PM
2607
September 19, 2011 04:10PM
2718
September 20, 2011 08:19PM
3076
September 25, 2011 12:09PM
2652
September 28, 2011 09:53PM
2851
September 29, 2011 02:44PM
3536
September 30, 2011 10:14AM
3441
September 10, 2011 03:07PM
3494
September 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.