Storing and converting UTF8 Arabic in MySQL DB using Perl
Posted by: Nasser Ahmed
Date: July 02, 2006 05:55AM

Hi,

I need a little help.

I initially had a text file with Arabic in it encoded using the windows-1256 charset. I used "iconv -f WINDOWS-1256 -t UTF-8 -o foo-out.txt foo.txt" to convert the file to UTF8.

The file now contains the following arabic:

مَنْ صَلَّى صَلَاةً لَمْ يَقْرَأْ فِيهَا بِأُمِّ الْقُرْآنِ فَهِيَ خِدَاجٌ

In a browser this utf8 data is displayed perfectly as Arabic (with the correct utf-8 charset encoding), however I need to store this data as native Arabic in a MySQL DB (4.1.18) but can't seem to convert and store the utf8 data as Arabic shown below.

مَنْ صَلَّى صَلَاةً لَمْ يَقْرَأْ فِيهَا بِأُمِّ الْقُرْآنِ فَهِيَ خِدَاجٌ

I am using Perl 5.8.0 to complete this task with the following commands:

$dbh->do("set character set utf8");
$dbh->do("set names utf8");

And also have the DB tables to the correct charset as well.

I have also tried the following MySQL function in Perl:

$test_utf8 = "CONVERT(_utf8'$data' USING utf8)";

But nothing seems to work.

Any help would be greatly appreciated?

Nasser



Edited 1 time(s). Last edit at 07/02/2006 07:24AM by Nasser Ahmed.

Options: ReplyQuote


Subject
Views
Written By
Posted
Storing and converting UTF8 Arabic in MySQL DB using Perl
4779
July 02, 2006 05:55AM


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.