Index: cvsspam.rb =================================================================== --- cvsspam.rb (revision 254) +++ cvsspam.rb (working copy) @@ -162,8 +162,9 @@ # gives a string starting "=?", and including a charset specification, that # marks the start of a quoted-printable character sequence - def marker_start_quoted - "=?#{@charset}?#{@encoding}?" + def marker_start_quoted(charset=nil) + charset = @charset if charset.nil? + "=?#{charset}?#{@encoding}?" end # test to see of the given string contains non-ASCII characters @@ -1243,7 +1244,7 @@ # an RFC 822 email address class EmailAddress - def initialize(text) + def initialize(text, charset=nil) if text =~ /^\s*([^<]+?)\s*<\s*([^>]+?)\s*>\s*$/ @personal_name = $1 @address = $2 @@ -1251,9 +1252,10 @@ @personal_name = nil @address = text end + @charset=charset end - attr_accessor :personal_name, :address + attr_accessor :personal_name, :address, :charset def has_personal_name? return !@personal_name.nil? @@ -1284,7 +1286,7 @@ # rfc2047 encode the word, if it contains non-ASCII characters def encode_word(word) if $encoder.requires_rfc2047?(word) - encoded = $encoder.marker_start_quoted + encoded = $encoder.marker_start_quoted(@charset) $encoder.each_char_encoded(word) do |code| encoded << code end @@ -1299,6 +1301,7 @@ cvsroot_dir = "#{ENV['CVSROOT']}/CVSROOT" $config = "#{cvsroot_dir}/cvsspam.conf" $users_file = "#{cvsroot_dir}/users" +$users_file_charset = nil $debug = false $recipients = Array.new @@ -1762,7 +1765,7 @@ io.each_line do |line| if line =~ /^([^:]+)\s*:\s*(['"]?)([^\n\r]+)(\2)/ if email.address == $1 - return EmailAddress.new($3) + return EmailAddress.new($3, $users_file_charset) end end end