I have a Ruby/Rails app.
I have an artists table in my postgresql database which I want to query by name. I have some artists with portuguese characters etc. and am having some issues querying them.
For example one band is called Legião Urbana. If I query with the string “legiã” from my app I get the following params:
{"action"=>"search_artist", "q"=>"legi\343", "controller"=>"home"}
However I get an error from the query
Artist.all(:conditions => "name LIKE '%#{params[:q]}%'")
PGError: ERROR: invalid byte sequence for encoding "UTF8": 0xe32527
What should I be doing to convert into UTF8 or fix this from happening somehow?
I think this might do it