3
I am using a script written in Ruby that parses some XML files and inserts the information in a Mysql group. It works perfectly well, but it’s giving me a headache now that my XML files have strings.
Detail: I’m completely new to Ruby.
For some reasons I’m stuck with Ruby 1.8 and I’ve been reading that this version has peculiarities to deal with Strings. I have already confirmed that both the XML file and the Mysql collation and tables are UTF-8.
I have also tried, unsuccessfully, to encode the string before sending it to the bank using a hint found in this post as follows:
@text = ::Iconv.conv('UTF-8//IGNORE', 'UTF-8', attributes['Text'] + ' ')[0..-2]
After inserting the eye data via Phpmyadmin the strings are hacked. For example: 'nâ³s' instead of 'no'.
Any idea how I can address the problem?
And what would it be, your collation of your table? Why often the collation of the bank and table are different... Just confirm that..
– Bruno Casali
Thanks @Brunocasali - to be specific: utf8_general_ci
– Nigini
Um, beauty, you tried let’s say serialize in another xml file, txt or write to another database or simply show on screen without the database ?
– Bruno Casali
Opa @Brunocasali. I had not tried and I could only see now. When printing on the screen I think the output system itself handles the character encoding because in the terminal the string comes out correct. =/
– Nigini