class QuickML::SubjectDecoder
Constants
- ENCODED_WORDS
Public Class Methods
decode(str)
click to toggle source
# File vendor/qwik/lib/qwik/mail-header.rb, line 195 def self.decode(str) str.gsub(ENCODED_WORDS) {|s| charset = $1.downcase encoding = $2.upcase contents = $3 decoder = self.new(charset, encoding, contents) decoder.decode } end
new(charset, encoding, contents)
click to toggle source
# File vendor/qwik/lib/qwik/mail-header.rb, line 205 def initialize(charset, encoding, contents) @charset = charset @encoding = encoding @contents = contents end
Public Instance Methods
convert_charset!()
click to toggle source
# File vendor/qwik/lib/qwik/mail-header.rb, line 230 def convert_charset! case @charset when "iso-2022-jp" @contents = @contents.jistosjis when "euc-jp" @contents = @contents.euctosjis when "shift_jis", "cp932" :do_nothing when "utf-8" @contents = @contents.u8tosjis end end
decode()
click to toggle source
# File vendor/qwik/lib/qwik/mail-header.rb, line 211 def decode return @contents if @charset.nil? and @encoding.nil? decode_encoding! convert_charset! return @contents end
decode_encoding!()
click to toggle source
# File vendor/qwik/lib/qwik/mail-header.rb, line 218 def decode_encoding! result = @contents case @encoding when "B" result = @contents.unpack("m").first when "Q" result = @contents.unpack("M").first result.gsub!("_", " ") end @contents = result end