Forum: Ruby on Rails actionmailer multibyte weirdness

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Sam J. (Guest)
on 2007-03-26 23:39
(Received via mailing list)
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

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.title = "Ho`ohanohano I Na Kupuna Puwalu ‘Elua: Ke Kumu Ike
@story.depttitle = "Science"
@story.summary = "jolly good"
@story.detail = "really jolly"
@story.user = @bob
response = StoryMailer.create_notify(,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{|u|}, response.bcc
assert_equal 'multipart/alternative', response.content_type

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

1) Failure:
[./test/unit/story_mailer_test.rb:73:in `test_notify_with_strange_chars'
./test/unit/../test_helper.rb:165:in `run'
./test/unit/../test_helper.rb:163:in `each'
./test/unit/../test_helper.rb:163:in `run'
./test/unit/../test_helper.rb:165:in `run'
./test/unit/../test_helper.rb:163:in `each'
./test/unit/../test_helper.rb:163:in `run']:
<"[disCourse:story] Ho`ohanohano 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

Many thanks in advance.
This topic is locked and can not be replied to.