ppremkumar has asked for the wisdom of the Perl Monks concerning the following question:
Hi, Team
I am back again for my next question.
I am trying to read line by line a text file with special characters and store each line in MySQL server, whose character set settings are shown below.
| Variable | Value |
|---|---|
| character_set_client | $utf8 |
| character_set_database | $utf8 |
| character_set_filesystem | $binary |
| character_set_results | $utf8 |
| character_set_server | $utf8 |
| character_set_system | $utf8 |
The charset of both the schema and the table is set as utf8.
Aderñŋšžľŀīửừứ, R., & Kelley, K. W. (2007). A global view of twenty years of Brain, Behavior, and Immunity. Brain, Behavior, and Immunity, 21, 20–22
Aderñŋšžľŀīá»á»«á»©, R., & Kelley, K. W. (2007). A global view of twenty years of Brain, Behavior, and Immunity. Brain, Behavior, and Immunity, 21, 20–22.
My code to read the text file includes: open $REF_INPUT_FH, '<:encoding(UTF-8)', $filepath . $job_number. '_BIB.txt';
I read each line and insert data:
$dbh->do("INSERT INTO es_ce_automation_bibliography_linking.`$job_chos +en` (bib_book_element, bib_ID, bib_item, bib_added_by, bib_added_date +) VALUES( '$book_element', '$temp_ID', '$temp_RefItem', '$created_by', now() )") or warn 'Some error!'
What am I doing wrong?
Thanks,
Prem
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Text File to MySQL: Encoding
by moritz (Cardinal) on Jul 05, 2013 at 10:43 UTC | |
by ppremkumar (Novice) on Jul 05, 2013 at 11:25 UTC |