|Just another Perl shrine|
Text File to MySQL: Encodingby ppremkumar (Novice)
|on Jul 05, 2013 at 10:27 UTC||Need Help??|
ppremkumar has asked for the
wisdom of the Perl Monks concerning the following question:
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.
The charset of both the schema and the table is set as utf8.
Input Text File Line
Aderñŋšžľŀīửừứ, R., & Kelley, K. W. (2007). A global view of twenty years of Brain, Behavior, and Immunity. Brain, Behavior, and Immunity, 21, 20–22
Corresponding Entry in MySQL
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:
What am I doing wrong?