Hi All,
[sorry if this ends up being a double-post]
Ie$B!Ge(Bve been having lots of fun with making a bilingual site in
Radiant. Here are some current problems that I hope someone can
suggest fixes for:
Pages in Shift-JIS charset
Most Japanese cellphones require Shift-JIS for mobile sites, but the
content-type field in Layout ignores charsets. Can anyone suggest how
Ie$B!Ge(Bd add support for charsets to this, or another way to work
around it?
Mailer extension and sending ISO-2022-JP emails
Despite ActiveMailer docs[1] containing this:
e$B!He(Bdefault_charset - The default charset used for the body and to
encode the subject. Defaults to UTF-8. You can also pick a different
charset from inside a method with charset.e$B!Ie(B
Setting this in environment.rb:
config.action_mailer.default_charset = "iso-2022-jp"
still results in my email header and body being UTF-8 encoded, with
body settings of:
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: Quoted-printable
If I add this to environment.rb:
config.action_mailer.default_content_type = "text/
plain;charset=iso-2022-jp"
I get the bizarre combo of utf-8 encoded subject and body settings of:
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: Iso-2022-jp
which is even worse. A Japanese article[2] suggests wrapping
ActionMailer in TMail then iso-2022-jp and base64 the email, but I
guess that requires a hack or an extension, right? heree$B!Ge(Bs their
code:
module ActionMailer #:nodoc:
class Base
require ‘nkf’
class << self
def base64(text, charset=“iso-2022-jp”, convert=true)
if convert
if charset == “iso-2022-jp”
text = NKF.nkf(‘-j -m0’, text)
end
end
text = [text].pack(‘m’).delete(“e(J\re(J\n”)
“=?#{charset}?B?#{text}?=”
end
end
end
end
class Notifications < ActionMailer::Base
@@default_charset = “iso-2022-jp”
@@encode_subject = false
#…
end
Then in test:
class NotificationsTest < Test::Unit::TestCase
CHARSET = “iso-2022-jp”
#…
private
def encode(subject)
ActionMailer::Base.base64(subject, CHARSET)
end
end
Anyone ever managed to get emails in non-UTF8 working
Finally, whate$B!Ge(Bs up with i18n and how can I help? I cane$B!Ge(Bt
even get the Jargon branch (with the partially baked gibberish
support) to run anymoree$B!De(B
peace - oli
[1] ActionMailer::Base
[2] http://wiki.fdiary.net/rails/?ActionMailer