mail_encoding_patch.rb 393 B

1234567891011121314151617181920
  1. require 'mail'
  2. module Mail
  3. module Utilities
  4. class ImprovedEncoder < BestEffortCharsetEncoder
  5. def pick_encoding(charset)
  6. case charset
  7. when /\Aiso-2022-jp\z/i
  8. Encoding::CP50220
  9. when /\Ashift_jis\z/i
  10. Encoding::Windows_31J
  11. else
  12. super
  13. end
  14. end
  15. end
  16. self.charset_encoder = ImprovedEncoder.new
  17. end
  18. end