# File lib/jpmobile/mail.rb, line 7 def self.b_value_decode(str) match = str.match(%r\=\?(.+)?\?[Bb]\?(.+)?\?\=/) if match encoding = match[1] str = self.decode_base64(match[2]) str.force_encoding(fix_encoding(encoding)) end # if str contains some emoticon, the following line raises Encoding error str.encode("utf-8", :invalid => :replace, :replace => "") rescue Jpmobile::Util.ascii_8bit(str) end
change encoding
# File lib/jpmobile/mail.rb, line 19 def self.b_value_encode(str, encoding) str = Jpmobile::Util.encode(str, encoding.to_s) [Ruby19.encode_base64(str), encoding] end