class method self.unquote_and_convert_to

Ruby on Rails 2.2.3

Since v2.2.3 Last seen in v2.3.18

Available in: v2.2.3 v2.3.18

Signature

self.unquote_and_convert_to(text, to_charset, from_charset = "iso-8859-1", preserve_underscores=false)

No documentation comment.

Parameters

text req
to_charset req
from_charset opt = "iso-8859-1"
preserve_underscores opt = false
Source
# File actionmailer/lib/action_mailer/vendor/tmail-1.2.3/tmail/quoting.rb, line 61
      def unquote_and_convert_to(text, to_charset, from_charset = "iso-8859-1", preserve_underscores=false)
        return "" if text.nil?
        text.gsub(/(.*?)(?:(?:=\?(.*?)\?(.)\?(.*?)\?=)|$)/) do
          before = $1
          from_charset = $2
          quoting_method = $3
          text = $4

          before = convert_to(before, to_charset, from_charset) if before.length > 0
          before + case quoting_method
              when "q", "Q" then
                unquote_quoted_printable_and_convert_to(text, to_charset, from_charset, preserve_underscores)
              when "b", "B" then
                unquote_base64_and_convert_to(text, to_charset, from_charset)
              when nil then
                # will be nil at the end of the string, due to the nature of
                # the regex used.
                ""
              else
                raise "unknown quoting method #{quoting_method.inspect}"
            end
        end
      end

Defined in actionmailer/lib/action_mailer/vendor/tmail-1.2.3/tmail/quoting.rb line 61 · View on GitHub · Improve this page · Find usages on GitHub

Defined in TMail::Unquoter

Type at least 2 characters to search.

↑↓ navigate · open · esc close