Skip to content

Commit

Permalink
Don't use NKF
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Apr 8, 2024
1 parent 3618a5a commit 76c8286
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
25 changes: 13 additions & 12 deletions lib/racknga/exception_mail_notifier.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2010-2011 Kouhei Sutou <kou@clear-code.com>
# Copyright (C) 2010-2024 Sutou Kouhei <kou@clear-code.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
Expand All @@ -16,13 +14,13 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

require 'time'
require 'net/smtp'
require 'etc'
require 'socket'
require 'nkf'
require "base64"
require "etc"
require "net/smtp"
require "socket"
require "time"

require 'racknga/utils'
require "racknga/utils"

module Racknga
# Ruby 1.9 only. 1.8 isn't supported.
Expand Down Expand Up @@ -198,10 +196,13 @@ def transfer_encoding
def encode_subject(subject)
case charset
when /\Aiso-2022-jp\z/i
NKF.nkf('-Wj -M', subject)
else
NKF.nkf('-Ww -M', subject)
subject = subject.encode("ISO-2022-JP")
end
base64_subject = Base64.encode64(subject)
lines = base64_subject.lines.collect do |line|
"=?#{charset}?B?#{line.chomp}?="
end
lines.join("\r\n")
end
end
end
2 changes: 2 additions & 0 deletions racknga.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ Gem::Specification.new do |spec|
spec.files += Dir.glob("example/*.rb")
spec.test_files = Dir.glob("test/**/*.rb")

spec.add_runtime_dependency("base64")
spec.add_runtime_dependency("csv")
spec.add_runtime_dependency("net-smtp")
spec.add_runtime_dependency("rack")

Expand Down

0 comments on commit 76c8286

Please sign in to comment.