Vcs: Send messages in Latin-1 by default

Hello, Voici deux propositions de patches pour Vcs et RubyEx qui permettent d'indiquer le jeu de caractères et l'encodage choisi pour poster des mail avec Vcs. Les deux sont par faits rapport à Vcs 0.5 beta 10 Le premier patch concerne Vcs, le second RubyEx, localisé dans vendor/ruby_ex dans la distribution de Vcs. Comment on fait pour soumettre ces patches et éventuellement les enregistrer ? 2007-02-09 Roland Levillain <roland@lrde.epita.fr> * lib/vcs/mail.rb (Vcs::default_options): Add two fields, `charset' and `encoding', to send mail in Latin-1 by default in Vcs. --- lib/vcs/mail.rb.orig 2007-02-09 11:18:32.000000000 +0100 +++ lib/vcs/mail.rb 2007-02-09 11:19:04.000000000 +0100 @@ -12,6 +12,9 @@ @@mailer ||= Sendmail.new @@default_options ||= { :mime => true, + # Use Latin-1 by default. + :charset => 'iso-8859-1', + :encoding => 'quoted-printable', :header => { 'X-Mailer' => "Vcs.mail (#{Vcs::Version})" } } cattr_accessor :mail_options 2007-02-09 Roland Levillain <roland@lrde.epita.fr> * lib/sendmail.rb (Sendmail::parse_mail_options): Add two fields in the options, `charset' and `encoding', selecting plain 7-bit ASCII by default, that the user can override. Add two options corresponding to these fields. Typos. --- vendor/ruby_ex/lib/sendmail.rb.orig 2007-02-09 11:18:12.000000000 +0100 +++ vendor/ruby_ex/lib/sendmail.rb 2007-02-09 11:48:43.000000000 +0100 @@ -20,7 +20,9 @@ :to => [], :server => ENV['SMTPSERVER'] || 'localhost:25', :header => {}, - :body => STDIN + :body => STDIN, + :charset => 'us-ascii', + :encoding => '7bit' ) string_args, hash_args = args.partition { |x| x.is_a?(String) } hash_args.each do |hash| @@ -75,9 +77,17 @@ opts.on('--header STRING', 'Add some header fields (Yaml syntax)') do |s| options.header.merge! YAML.load(s) end - opts.on('-m', '--[no-]mime', 'Choose the mime protocole') do |mime| + opts.on('-m', '--[no-]mime', 'Choose the MIME protocol') do |mime| options.mime = mime end + opts.on('--charset STRING', + 'Choose a charset for the encoding') do |aCharset| + options.charset = aCharset + end + opts.on('--encoding STRING', + 'Choose an encoding') do |anEncoding| + options.encoding = anEncoding + end opts.on_tail('-h', '--help', 'Show this message') do puts opts exit @@ -156,11 +166,11 @@ TempPath.new do |mail_body| mail_body.open('w') do |out| if opts.mime - out.puts ' - |Content-Type: text/plain; charset="us-ascii" - |Content-Transfer-Encoding: 7bit + out.puts " + |Content-Type: text/plain; charset=\"#{opts.charset}\" + |Content-Transfer-Encoding: #{opts.encoding} | - |'.head_cut! + |".head_cut! end out.print body end
participants (1)
-
Roland Levillain