diff options
| author | Takashi Kokubun <takashikkbn@gmail.com> | 2025-10-08 16:30:58 -0700 |
|---|---|---|
| committer | Takashi Kokubun <takashikkbn@gmail.com> | 2025-10-08 16:32:10 -0700 |
| commit | dbb5972b340f24d9ff4f3996f57439d5a6b3454e (patch) | |
| tree | 83a78ca4f894c5ad99e6506d0652ba5fe1edab19 /tool/commit-email.rb | |
| parent | afb21f34987e47932b92530f48a19992863b29b1 (diff) | |
commit-email.rb: Use base64 instead of nkf
which makes it more obvious what it's doing.
Diffstat (limited to 'tool/commit-email.rb')
| -rwxr-xr-x | tool/commit-email.rb | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/tool/commit-email.rb b/tool/commit-email.rb index d9f79f41c9..d5b17a09c2 100755 --- a/tool/commit-email.rb +++ b/tool/commit-email.rb @@ -1,7 +1,7 @@ #!/usr/bin/env ruby require "optparse" -require "nkf" +require "base64" require "shellwords" CommitEmailInfo = Struct.new( @@ -207,7 +207,8 @@ class << CommitEmail private def b_encode(str) - NKF.nkf('-WwM', str) + base64_str = Base64.encode64(str.force_encoding('UTF-8')).strip # NKF.nkf('-WwMB', str) + "=?UTF-8?B?#{base64_str}?=" end def make_body(info, viewer_uri:) @@ -351,7 +352,7 @@ class << CommitEmail escaped_name = name.gsub(/["\\\n]/) { |c| "\\#{c}" } %Q["#{escaped_name}" <#{email}>] else - escaped_name = "=?UTF-8?B?#{NKF.nkf('-WwMB', name)}?=" + escaped_name = b_encode(name) %Q[#{escaped_name} <#{email}>] end end |
