So i have some Unicode(Arabic) text data stored in a Mongoid model and i want to insert it into a mysql database. I had to use gsub to escape single quotes as that was causing me SQL insertion errors.
text = model.text.squish().gsub("'", %q(\\\'))
db_con.query("insert into table (text) values ('#{text}')")
Now my problem is when i view the data at phpmyadmin this what i see
اليوم.. ملايين الهوات٠تودع "واتساب" للأبد
I tried adding force_encoding('UTF-8')
but that didn't change anything, i also tried escaping with str.dump
but that transformed the data into Unicode code points like u{243} when viewed in phpmyadmin. How can this be fixed.