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

Encoding problem in actionmailer subject #3824

Closed
ghost opened this issue Dec 1, 2011 · 6 comments
Closed

Encoding problem in actionmailer subject #3824

ghost opened this issue Dec 1, 2011 · 6 comments

Comments

@ghost
Copy link

ghost commented Dec 1, 2011

When subject is too long (apparently more or less 80 characters), the string is splitted in two lines. If the first line has an UTF-8 characters, it is converted in utf-8, if the second has no UTF-8 characters, it is not converted in UTF-8. The problem is, in this case only, the space between the last word of the first line and the first word of the second line disapears,

Test case:

=== My Email subject: ===
[tag: reset-password] Réinitialisation de votre mot de passe

=== Rails log on email sent (/!\ with exactly the same new line " de passe"): ===
Subject: =?UTF-8?Q?[tag:_reset-password]_R=C3=A9initialisation_de_votre_mot?=
de passe

=== EMail header ===
Subject: =?utf-8?q?_R=C3=A9initialisation_de_votre_motde_passe?=

@kennyj
Copy link
Contributor

kennyj commented Dec 1, 2011

I can reproduce this issue.

I think that this issue is mail gem's issue (not rails's one).
When folding subject, a line without non-ascii (a.k.a. ascii only) isn't encoded.

Please let me think :-)

@kennyj
Copy link
Contributor

kennyj commented Dec 1, 2011

I think that Mail::UnstructuredField#fold method (and around) has bug.
I try to fix it, but it seems that it's difficult.
Likely need more time ;-)

@kennyj
Copy link
Contributor

kennyj commented Dec 3, 2011

I have tackled this issue. and I have some improvement.
The folding behavior checked including non-ascii-character every line.
But a mailer (ex gmail)'s behavior checked one whole subject.
I fixed this behavior.

Please edit your Gemfile, and bundle install

gem 'mail', :git => 'git://github.com/kennyj/mail.git', :branch => 'rails_issue_3824'

@ghost
Copy link
Author

ghost commented Dec 6, 2011

It works ! Thank you very much !

@kennyj
Copy link
Contributor

kennyj commented Dec 7, 2011

@tompat thanks your report !

I opened pull request for the mail.gem.
(mikel/mail#308)

/cc @josevalim @spastorino

@drogus
Copy link
Member

drogus commented Dec 10, 2011

I'm closing this, since it's not a rails bug.

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

No branches or pull requests

2 participants