Actionmailer multibyte weirdness


#1

Hi There,

I have an odd issue with the way actionmailer does multibyte conversion
on mail subject lines.

I have two debian boxes, both running ruby 1.8.2-7sarge2 and Rails
1.0.0.

I set up a unit test to check exactly what was happening to the subject
line of the mail:

def test_notify_with_strange_chars
users = User.find_all
@story = Story.new
@story.title = “Ho`ohanohano I Na Kupuna Puwalu ‘Elua: Ke Kumu Ike
Hawai’i”
@story.depttitle = “Science”
@story.summary = “jolly good”
@story.detail = “really jolly”
@story.user = @bob
@story.save
response = StoryMailer.create_notify(MockController.new,users,@story)
assert_equal ‘[’+CommunitySystem::CONFIG[:app_name]+’:story] '+
@story.title, response.subject
assert_match /stories/show/1/, response.body
#assert_match /New Password: #{newpass}/, response.body
assert_equal users.map{|u| u.email}, response.bcc
assert_equal ‘multipart/alternative’, response.content_type
end

Now this passes just fine on one box, but on the other I get this error:

  1. Failure:
    test_notify_with_strange_chars(StoryMailerTest)
    [./test/unit/story_mailer_test.rb:73:in test_notify_with_strange_chars' ./test/unit/../test_helper.rb:165:inrun’
    ./test/unit/…/test_helper.rb:163:in each' ./test/unit/../test_helper.rb:163:inrun’
    ./test/unit/…/test_helper.rb:165:in run' ./test/unit/../test_helper.rb:163:ineach’
    ./test/unit/…/test_helper.rb:163:in run']: <"[disCourse:story] Hoohanohano I Na Kupuna Puwalu \201eElua: Ke Kumu
    Ike Hawai\201fi"> expected but was
    <"[disCourse:story] Ho`ohanohano I Na Kupuna Puwalu \302\201eElua: Ke
    Kumu Ike Hawai\302\201fi">.

which looks very much like the single byte unicode are being converted
to multibyte unicode on this box.

Has anyone got any idea what might cause one box to act differently to
the other? I assume there is some library somewhere that is causing this
discrepancy. Any tips on where to look?

The reason this is a problem is that the presence of these multibyte
characters in the mail header lead the mails to be sent out with blank
subject lines,. presumably because the ruby mailer can’t handle them or
something.

Many thanks in advance.
CHEERS> SAM