diff options
author | Rick Olson <technoweenie@gmail.com> | 2007-11-06 14:24:32 +0000 |
---|---|---|
committer | Rick Olson <technoweenie@gmail.com> | 2007-11-06 14:24:32 +0000 |
commit | 2a51c8682d44ee71a3c0411e2e30ef8ff29d6f67 (patch) | |
tree | 071f2cb958c46c0c07034c9837800dba572a5218 /actionmailer/lib/action_mailer/vendor/tmail/encode.rb | |
parent | 7464a398e18592010243845edad1fa09b82d16a1 (diff) | |
download | rails-2a51c8682d44ee71a3c0411e2e30ef8ff29d6f67.tar.gz rails-2a51c8682d44ee71a3c0411e2e30ef8ff29d6f67.tar.bz2 rails-2a51c8682d44ee71a3c0411e2e30ef8ff29d6f67.zip |
Update TMail to v1.1.0. Use an updated version of TMail if available. [mikel]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8084 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionmailer/lib/action_mailer/vendor/tmail/encode.rb')
-rwxr-xr-x | actionmailer/lib/action_mailer/vendor/tmail/encode.rb | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/actionmailer/lib/action_mailer/vendor/tmail/encode.rb b/actionmailer/lib/action_mailer/vendor/tmail/encode.rb index 91bd289c5b..0721a25490 100755 --- a/actionmailer/lib/action_mailer/vendor/tmail/encode.rb +++ b/actionmailer/lib/action_mailer/vendor/tmail/encode.rb @@ -1,6 +1,8 @@ -# -# encode.rb -# +=begin rdoc + += Text Encoding class + +=end #-- # Copyright (c) 1998-2003 Minero Aoki <aamine@loveruby.net> # @@ -50,23 +52,25 @@ module TMail end end module_function :create_dest - + def encoded( eol = "\r\n", charset = 'j', dest = nil ) accept_strategy Encoder, eol, charset, dest end - + def decoded( eol = "\n", charset = 'e', dest = nil ) + # Turn the E-Mail into a string and return it with all + # encoded characters decoded. alias for to_s accept_strategy Decoder, eol, charset, dest end - + alias to_s decoded - + def accept_strategy( klass, eol, charset, dest = nil ) dest ||= '' - accept klass.new(create_dest(dest), charset, eol) + accept klass.new( create_dest(dest), charset, eol ) dest end - + end @@ -141,6 +145,7 @@ module TMail end def kv_pair( k, v ) + v = dquote(v) unless token_safe?(v) @f << k << '=' << v end @@ -190,9 +195,18 @@ module TMail @f = StrategyInterface.create_dest(dest) @opt = OPTIONS[$KCODE] @eol = eol + @preserve_quotes = true reset end + def preserve_quotes=( bool ) + @preserve_quotes + end + + def preserve_quotes + @preserve_quotes + end + def normalize_encoding( str ) if @opt then NKF.nkf(@opt, str) |