List:General Discussion« Previous MessageNext Message »
From:Jon Forsyth Date:December 10 2011 9:20pm
Subject:Writing Arabic Text to a DataBase with Perl
View as plain text  
Hello,

I hope someone can help me solve this.  I am trying to write 2 string
values to separate fields of the same row in a mysql DB table using the
Perl Module DBD::mysql.  One string value is of English letters, while the
other is of Arabic letters.  However, they are somehow switched and written
to the wrong field--the Arabic to the English and English to the Arabic
field.  I believe my file handle declaration ensures that the encoding i'm
dealing with is UTF-8:

---
open my $file, '<:encoding(utf8)', 'input_file.xml' or die "cannot open
file: $!";
---

and the mysql query:

---
$dbh->do("INSERT INTO bama_xml (token_Arabic, variant) VALUES
('$arab','$engl');");
---


I tried switching the values as below, but they still write to the wrong
place.

---
$dbh->do("INSERT INTO bama_xml (token_Arabic, variant) VALUES
('$engl','$arab');");
---

I also dropped the English string completely, but the Arabic still writes
to the wrong field--strange behavior, but I'm sure it's a problem with the
Arabic.

Thanks,

Jon

Thread
Writing Arabic Text to a DataBase with PerlJon Forsyth10 Dec
  • Re: Writing Arabic Text to a DataBase with Perlhsv13 Dec
  • Re: Writing Arabic Text to a DataBase with PerlRudolf Lippan13 Dec
Re: Writing Arabic Text to a DataBase with PerlJon Forsyth13 Dec
  • Re: Writing Arabic Text to a DataBase with PerlShiva13 Dec