Witam,
próbuję wydobyć charset z nagłówka Content-Type pewnego maila. Nagłówek ten wygląda następująco:
Content-Type: text/plain; charset=utf-8;
format=flowed reply-type=original
Próbowałam na różne sposoby:
mail.header['content-type'] # => #<TMail::ContentTypeHeader "text/plain; charset=utf-8;\n format=flowed\treply-type=original">
mail.header['content-type']['charset'] # => nil
aż wreszcie mail.header[‘content-type’].to_s wyrzuciło
NoMethodError: You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.each
from /usr/lib/ruby/gems/1.8/gems/tmail-1.2.3.1/lib/tmail/header.rb:816:in `do_accept'
from /usr/lib/ruby/gems/1.8/gems/tmail-1.2.3.1/lib/tmail/header.rb:165:in `accept'
from /usr/lib/ruby/gems/1.8/gems/tmail-1.2.3.1/lib/tmail/encode.rb:98:in `accept_strategy'
from /usr/lib/ruby/gems/1.8/gems/tmail-1.2.3.1/lib/tmail/encode.rb:91:in `to_s'
from (irb):13
Możecie mi podpowiedzieć jak wydobyć ten charset?