Ruby on Rails Tuesday, December 30, 2014

Hello you all, hope you're all having some nice holidays! :p

Here is the deal with me: incompatible character encodings: UTF-8 and ASCII-8BIT
I used a seed ( to populate my DB with cities and states of my country, so I can fill a select box for registering, but when I try to exhibit it I get this error:

incompatible character encodings: UTF-8 and ASCII-8BIT

this is one of my select_boxes:
<%= f.collection_select(:birth_state, State.all, :id, :name, {:prompt => "State"}, {:class=> 'form-control'}) %>

And also I'm using a mysql database, with the mysql gem, and I have seen some records like:
<City id: 5560, name: "Xambio\xC3\xA1", capital: false, state_id: 27,..>

Making me think it's a problem cause of special portuguese characters like ç, á, à, ã... I have heard also that mysql/rails doesn't convert automatically the encodings or something like that, but honestly I have no clue on how doing that. If anyone got a clue, happy to hear it.

Thank you all in advance!
Happy holidays,

Diego Dillenburg Bueno
Graduando em Ciências da Computação
UNESP - Rio Claro
(12) 98116-7741

You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To post to this group, send email to
To view this discussion on the web visit
For more options, visit

No comments:

Post a Comment