Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Non english characters on email templates cause escaping #2086

Closed
victormartins opened this issue Oct 4, 2012 · 9 comments
Closed

Non english characters on email templates cause escaping #2086

victormartins opened this issue Oct 4, 2012 · 9 comments

Comments

@victormartins
Copy link

When using non english characters on the confirmation email, like "Olá" the email gets escaped and the token seems to get invalid.
Someone posted this problem like a year ago: http://stackoverflow.com/questions/4793504/rails-3-and-devise-escaping-mailer-templates
Is solution is ok, but is there a way to prevent devise to escape the characters?

@josevalim
Copy link
Contributor

This is weird and I have written templates in portuguese and I haven't seen it before. It makes me think it is not a Devise issue, but a Rails one. If you put those characters in any other template, not necessarily a Devise one, does the issue still happen?

@victormartins
Copy link
Author

Sorry, for the delay, I went on vacation :)

I've done the tutorial from rails casts 206 and sent emails with and without latin chars, in text and html without any escaping.

With Devise If I write the word Olá, I get the email get's like this: http://pastie.org/5064730
This must be something simple to solve, I just can't seem to find the issue :(

Using Rails 3.2.8
And Ruby 1.9.3p286 (2012-10-12 revision 37165) [x86_64-linux]
on Heroku

@josevalim
Copy link
Contributor

What is the template name? Can you provide an app that reproduces the error?

José Valim
www.plataformatec.com.br
Founder and Lead Developer
*

@victormartins
Copy link
Author

The templates are:
confirmation_instructions.html.erb
reset_password_instructions.html.erb
unlock_instructions.html.erb

When I get home I will try to do an app with the problem.

Thanks :)

@victormartins
Copy link
Author

Here it is a simple test:
https://github.com/victormartins/DeviseTest

As you can see in with the last commit, just adding "Olá" breaks the email by sending the url escaped like so:
http://pastie.org/5069701

Without the Olá, everything looks fine:
http://pastie.org/5069703

What do you think?

Thanks for looking at this José :)

@josevalim
Copy link
Contributor

Hey @victormartins, before I give it a shot, would you mind adding a mailer template to the same app but without using Devise that works just fine as you said previously? Thanks!

@victormartins
Copy link
Author

Hello,

Well now I'm completed lost, this really seems a rails configuration issue.
I've added the mailer on a different computer, and in this example the email sent with my mailer template gets like this:
http://pastie.org/5072842

I've noticed that now those templates have:
Content-Transfer-Encoding: base64

While Devise gets:
Content-Transfer-Encoding: quoted-printable

I don't know what I did different at home to send the email email with the latim characters, because in both situations I just followed Ryan Bates tutorial.

If you want to give it a try do rake db:seed and enter with
user@user.com
999999

Then on the top of the page click " Say Hello" and in the console you will see the mailer sending the email.

@josevalim
Copy link
Contributor

How do they look like when you access them in your gmail?
The same? Or the characters are gone too?

@victormartins
Copy link
Author

Brrr shame on me 👎 .... just tested it on my heroku app and on gmail it looks fine.
I think that at the time I was trying to copy paste the confirmation urls from the console while testing and they sudently broke after changing the template.They probably worked on a real email reader all along.

Sorry for wasting your time :(

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

No branches or pull requests

2 participants