Encoding issue in mailer view (ruby 1.9.2) #1062

aurels opened this Issue May 11, 2011 · 8 comments


None yet
3 participants

aurels commented May 11, 2011


I'm on an app with Devise 1.1.8. I added a custom "name" field to the user model, my database is in UTF-8 (also in the database.yml).

The Devise::Mailer fails with this stacktrace : http://pastie.org/1888286 The line where it fails is :

  <p>Bonjour <%= @resource.name %>,</p>

in confirmation_instructions.html.erb where I am using the custom attribute "name".

Any ideas ? I'm not sure that this is a devise issue.

Notes :

  • my encoding is set to UTF-8 for views
  • I'm using the mysql2 gem

josevalim commented May 11, 2011

This is very very weird as you said you are using mysql2 gem and UTF8 for views. No idea what could be, but it doesn't feel like a Devise issue though. :(

aurels commented May 11, 2011

Yes that weird. The weirdest is that I only have that in devise's mailer views...


josevalim commented May 11, 2011

I assume adding <%#encoding: utf-8%> or #encoding: utf-8 to the first line is not going to fix it?

aurels commented May 11, 2011

Yes I tried both # coding and # encoding headers ;-)

I got similar error when my confirmation_instructions.html.erb contained some special chars (öäüõ) and was saved with encoding other than utf-8. Is your confirmation_instructions.html.erb saved with utf-8?

aurels commented May 18, 2011

Yes it is. Thanks anyway ;-)


josevalim commented Jun 8, 2011

Hey @aurels, any news here? Have you found out what is the issue?

aurels commented Jun 9, 2011

Hey Jose,

No clue :/ I don't use the custom field in the view anymore to avoid the issue...

josevalim closed this Jul 3, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment