# Actionmailer multibyte weirdness

**URL:** <https://www.ruby-forum.com/t/actionmailer-multibyte-weirdness/90222>\
**Category:** Rails\
**Created:** [March 26, 2007, 9:39pm UTC](https://www.ruby-forum.com/t/actionmailer-multibyte-weirdness/90222 "2007-03-26T21:39:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![samj](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/77aa72/32.png) [@samj](https://www.ruby-forum.com/u/samj)\
**Post date:** [March 26, 2007, 9:39pm UTC](https://www.ruby-forum.com/t/actionmailer-multibyte-weirdness/90222/1 "2007-03-26T21:39:29Z")

</div>

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: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  
something.

Many thanks in advance.  
CHEERS\> SAM
