monde/mms2r — Issue #11: Sprint UndefinedConversionError with ruby 1.9.2
Author: jpmcgrath
Created: 2011-12-07 05:58:02+00:00
State: open

This works fine:

ruby -rrubygems -Ilib -e "require 'mms2r'; require 'pp'; require 'logger'; mms = MMS2R::Media.new(Mail.read('/home/j/downloads/84.yml'), :logger => Logger.new(STDOUT)); pp mms.media; pp mms.number; pp mms.carrier; pp mms.mail.parts.first.body"

If we add "require rails;" to the mix:

ruby -rrubygems -Ilib -e "require 'rails'; require 'mms2r'; require 'pp'; require 'logger'; mms = MMS2R::Media.new(Mail.read('/home/j/downloads/84.yml'), :logger => Logger.new(STDOUT)); pp mms.media; pp mms.number; pp mms.carrier; pp mms.mail.parts.first.body"

we get:

MMS2R::Media created
MMS2R::Media processing
MMS2R::Media writing file /tmp/j/mms2r/332041621323016500006JavaMaillsadmpcs-nams003_6d05cddd835393daccfb871e7a40657a33e8dd64/1/041_0a3996dbcc9f0451_1-0.jpg
/home/j/.rvm/gems/ruby-1.9.2-p290@mms2r/gems/mms2r-3.5.0/lib/mms2r/media/sprint.rb:188:in `write': "\xFF" from ASCII-8BIT to UTF-8 (Encoding::UndefinedConversionError)
from /home/j/.rvm/gems/ruby-1.9.2-p290@mms2r/gems/mms2r-3.5.0/lib/mms2r/media/sprint.rb:188:in `block in sprint_write_file'
from /home/j/.rvm/gems/ruby-1.9.2-p290@mms2r/gems/mms2r-3.5.0/lib/mms2r/media/sprint.rb:188:in `open'
from /home/j/.rvm/gems/ruby-1.9.2-p290@mms2r/gems/mms2r-3.5.0/lib/mms2r/media/sprint.rb:188:in `sprint_write_file'
from /home/j/.rvm/gems/ruby-1.9.2-p290@mms2r/gems/mms2r-3.5.0/lib/mms2r/media/sprint.rb:167:in `block in sprint_process_media'
from /home/j/.rvm/gems/ruby-1.9.2-p290@mms2r/gems/mms2r-3.5.0/lib/mms2r/media/sprint.rb:130:in `each'
from /home/j/.rvm/gems/ruby-1.9.2-p290@mms2r/gems/mms2r-3.5.0/lib/mms2r/media/sprint.rb:130:in `sprint_process_media'
from /home/j/.rvm/gems/ruby-1.9.2-p290@mms2r/gems/mms2r-3.5.0/lib/mms2r/media/sprint.rb:61:in `process'
from /home/j/.rvm/gems/ruby-1.9.2-p290@mms2r/gems/mms2r-3.5.0/lib/mms2r/media.rb:219:in `initialize'
from -e:1:in `new'
from -e:1:in `

'

This was using a rvm gemset for ruby 1.9.2. The gems I installed were:
gem install mms2r
gem install rails

This resulted in the following gems and dependencies being installed:

*** LOCAL GEMS ***

actionmailer (3.1.3)
actionpack (3.1.3)
activemodel (3.1.3)
activerecord (3.1.3)
activeresource (3.1.3)
activesupport (3.1.3)
arel (2.2.1)
builder (3.0.0)
bundler (1.0.21)
erubis (2.7.0)
exifr (1.1.1)
hike (1.2.1)
i18n (0.6.0)
json (1.6.3)
mail (2.3.0)
mime-types (1.17.2)
mms2r (3.5.0)
multi_json (1.0.4)
nokogiri (1.5.0)
polyglot (0.3.3)
rack (1.3.5)
rack-cache (1.1)
rack-mount (0.8.3)
rack-ssl (1.3.2)
rack-test (0.6.1)
rails (3.1.3)
railties (3.1.3)
rake (0.9.2)
rdoc (3.11)
sprockets (2.0.3)
thor (0.14.6)
tilt (1.3.3)
treetop (1.4.10)
tzinfo (0.3.31)
uuidtools (2.1.2)

So something in there is stuffing things up.