sup

A curses threads-with-tags style email client

sup.git

git clone https://supmua.dev/git/sup/
commit 5f475d01ead497b7f51cfb28f5f631b9ce146205
parent ed843833f17338fb99a9b8954981b9ea0ed54694
Author: William Morgan <wmorgan-sup@masanjin.net>
Date:   Sun,  3 Jan 2010 09:52:18 -0500

Merge branch 'ruby-1.9-encoding' into next

Diffstat:
M lib/sup/buffer.rb | 4 ++--
M lib/sup/crypto.rb | 2 ++
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/lib/sup/buffer.rb b/lib/sup/buffer.rb
@@ -611,7 +611,7 @@ EOS
   def ask_getch question, accept=nil
     raise "impossible!" if @asking
 
-    accept = accept.split(//).map { |x| x[0] } if accept
+    accept = accept.split(//).map { |x| x.ord } if accept
 
     status, title = get_status_and_title @focus_buf
     Ncurses.sync do
@@ -647,7 +647,7 @@ EOS
   ## returns true (y), false (n), or nil (ctrl-g / cancel)
   def ask_yes_or_no question
     case(r = ask_getch question, "ynYN")
-    when ?y, ?Y
+    when ?y.ord, ?Y.ord
       true
     when nil
       nil
diff --git a/lib/sup/crypto.rb b/lib/sup/crypto.rb
@@ -130,6 +130,7 @@ class CryptoManager
     end
 
     output = IO.read output_fn.path
+    output.force_encoding Encoding::ASCII_8BIT if output.respond_to? :force_encoding
 
     ## there's probably a better way to do this, but we're using the output to
     ## look for a valid signature being present.
@@ -157,6 +158,7 @@ class CryptoManager
     msg = RMail::Parser.read output
     if msg.header.content_type =~ %r{^multipart/} && !msg.multipart?
       output = "MIME-Version: 1.0\n" + output
+      output.force_encoding Encoding::ASCII_8BIT if output.respond_to? :force_encoding
       msg = RMail::Parser.read output
     end
     notice = Chunk::CryptoNotice.new :valid, "This message has been decrypted for display"