public
Description: Ruby on Rails
Homepage: http://rubyonrails.org
Clone URL: git://github.com/rails/rails.git
Search Repo:
Made Action Mailer templates use UTF-8 as default

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@739 
5ecf4fe2-1ee6-0310-87b1-e25e094e27de
dhh (author)
Tue Feb 22 05:34:57 -0800 2005
commit  148f6d8fb6ea028b2738a0553f058e903268a0b8
tree    edfc549dd7793ff03cd78e92c521f037060e4b50
parent  cf659de14140950638f2f02831a42721fd8d2f75
...
140
141
142
143
144
145
 
 
146
147
148
149
 
150
151
152
...
140
141
142
 
 
 
143
144
145
146
147
 
148
149
150
151
0
@@ -140,13 +140,12 @@
0
         send("perform_delivery_#{delivery_method}", mail) if perform_deliveries
0
       end
0
 
0
- def quoted_printable( text, charset )
0
- text = text.gsub( /[^a-z ]/i ) { "=%02x" % $&[0] }.
0
- gsub( / /, "_" )
0
+ def quoted_printable(text, charset)
0
+ text = text.gsub( /[^a-z ]/i ) { "=%02x" % $&[0] }.gsub( / /, "_" )
0
         "=?#{charset}?Q?#{text}?="
0
       end
0
 
0
- private
0
+ private
0
         def perform_delivery_smtp(mail)
0
           Net::SMTP.start(server_settings[:address], server_settings[:port], server_settings[:domain],
0
               server_settings[:user_name], server_settings[:password], server_settings[:authentication]) do |smtp|
...
3
4
5
 
6
7
8
9
...
10
11
12
 
13
14
15
16
17
 
18
19
20
...
25
26
27
 
 
 
 
28
29
...
3
4
5
6
7
8
9
10
...
11
12
13
14
15
16
17
18
 
19
20
21
22
...
27
28
29
30
31
32
33
34
35
0
@@ -3,6 +3,7 @@
0
 
0
 class <%= class_name %>Test < Test::Unit::TestCase
0
   FIXTURES_PATH = File.dirname(__FILE__) + '/../fixtures'
0
+ CHARSET = "utf-8"
0
 
0
   def setup
0
     ActionMailer::Base.delivery_method = :test
0
0
@@ -10,11 +11,12 @@
0
     ActionMailer::Base.deliveries = []
0
 
0
     @expected = TMail::Mail.new
0
+ @expected.set_content_type "text", "plain", { "charset" => CHARSET }
0
   end
0
 
0
 <% for action in actions -%>
0
   def test_<%= action %>
0
- @expected.subject = '<%= class_name %>#<%= action %>'
0
+ @expected.subject = encode '<%= class_name %>#<%= action %>'
0
     @expected.body = read_fixture('<%= action %>')
0
     @expected.date = Time.now
0
 
0
@@ -25,6 +27,10 @@
0
   private
0
     def read_fixture(action)
0
       IO.readlines("#{FIXTURES_PATH}/<%= file_name %>/#{action}")
0
+ end
0
+
0
+ def encode(subject)
0
+ ActionMailer::Base.quoted_printable(subject, CHARSET)
0
     end
0
 end

Comments

    No one has commented yet.