> I am sending mails with rails in German. The Problem is that the German > letters ä,ü,ö are arriving correctly at the receiver.
> When the subject contains the word
> Für
> the receiver gets
> Für
> Does anybody knows this issue?
This is strange. ActionMailer (or is it TMail?) should encode this correctly like =?utf-8?Q?=C3=84=C3=96=C3=9C?= (this is ÄÖÜ). For me it does it very well. What version do you use and what is your code?
>> I am sending mails with rails in German. The Problem is that the German >> letters ä,ü,ö are arriving correctly at the receiver.
>> When the subject contains the word
>> Für
>> the receiver gets
>> Für
>> Does anybody knows this issue?
> This is strange. ActionMailer (or is it TMail?) should encode this > correctly like =?utf-8?Q?=C3=84=C3=96=C3=9C?= (this is ÄÖÜ). For me it > does it very well. What version do you use and what is your code?
> Regards, T.
I am riding on 2.2.2 with Actionmailer and my code is
def invoice(kwiker, url, name) setup_email(kwiker) @subject += 'Rechnung für Bestellung bei kwikit.de Grusskarten' @body[:url] = "http://#{APP_CONFIG['site_host']}/"
part :content_type => "text/plain", :body => render_message("invoice.html.erb", body)
attachment :content_type => "application/pdf", :body => File.read(url), :filename => name end
Adam Meyer wrote: > ... > I am riding on 2.2.2 with Actionmailer and my code is
I have 2.3.4; maybe it's a new feature that the headers are quoted automatically.
For now you could do it by hand. Somewhere in the TMail module must be the function to make RFC 2231 headers. I can't find it now. So a temporary solution was:
T. N.t. wrote: > Adam Meyer wrote: >> ... >> I am riding on 2.2.2 with Actionmailer and my code is
> I have 2.3.4; maybe it's a new feature that the headers are quoted > automatically.
> For now you could do it by hand. Somewhere in the TMail module must be > the function to make RFC 2231 headers. I can't find it now. So a > temporary solution was:
> T. N.t. wrote: >> Adam Meyer wrote: >>> ... >>> I am riding on 2.2.2 with Actionmailer and my code is
>> I have 2.3.4; maybe it's a new feature that the headers are quoted >> automatically.
>> For now you could do it by hand. Somewhere in the TMail module must be >> the function to make RFC 2231 headers. I can't find it now. So a >> temporary solution was:
>> A more advanced function would break longer strings into multiple lines.
>> Hope this helps, T.
> hmm... but its not only in the subject. its in body too.
> I am scared to update my rails, I dont want my app to break down > completely.
You should not be scared to try an update, specify version 2.2.2 in environment.rb (or freeze 2.2.2 into the app), install the later version of rails and modify your app on a branch in your version control system (I prefer git) so you can experiment without affecting your working code. Then when all is working on the branch simply merge it into the trunk.
T. N.t. wrote: > Adam Meyer wrote: >> hmm... but its not only in the subject. its in body too.
> I don't know what @body[:url] is, but for
> part :content_type => "text/plain", > :body => render_message("invoice.html.erb", body)
> you probably should say :content_type => 'text/plain; charset=utf-8'
> T.
@body[:url] is just a value I want to use in the email template. Your solution might work in the body, but what is with the subject? -- Posted via http://www.ruby-forum.com/.
Adam Meyer wrote: > T. N.t. wrote: >> Adam Meyer wrote: >>> hmm... but its not only in the subject. its in body too.
>> I don't know what @body[:url] is, but for
>> part :content_type => "text/plain", >> :body => render_message("invoice.html.erb", body)
>> you probably should say :content_type => 'text/plain; charset=utf-8'
>> T.
> @body[:url] is just a value I want to use in the email template. > Your solution might work in the body, but what is with the subject? As I already wrote:
Adam Meyer wrote: > I don't know what is happening in you code, but it works. > Thanks!
Honestly, I also don't understand this pack command, but what happens is, that it encodes the string as quoted-printable. In
=?utf-8?Q?string?=
utf-8 is obviously the charset/encoding, Q is the way the bytes are represented with 7-bit characters, which is quoted-printable (Q) or base64 (B) and then comes obviously the string. So instead of that cryptic ['string'].pack("M").chomp you could also do
"=?utf-8?B?#{Base64.b64encode(@subject).chomp}?="
But quoted-printable is more adequate for european texts.