* epg-config.el (epg-debug): Moved from epg.el.
[elisp/epg.git] / epg.el
diff --git a/epg.el b/epg.el
index 6000dc5..29f78f8 100644 (file)
--- a/epg.el
+++ b/epg.el
@@ -38,7 +38,6 @@
 (defvar epg-pending-status-list nil)
 (defvar epg-key-id nil)
 (defvar epg-context nil)
-(defvar epg-debug nil)
 (defvar epg-debug-buffer nil)
 
 ;; from gnupg/include/cipher.h
@@ -950,11 +949,18 @@ This function is for internal use only."
                  (when passphrase
                    (setq passphrase-with-new-line (concat passphrase "\n"))
                    (epg--clear-string passphrase)
-                   (setq passphrase nil
-                         encoded-passphrase-with-new-line
-                         (encode-coding-string passphrase-with-new-line
-                                               (terminal-coding-system)))
-                   
+                   (setq passphrase nil)
+                   (if epg-locale-coding-system
+                       (progn
+                         (setq encoded-passphrase-with-new-line
+                               (encode-coding-string
+                                passphrase-with-new-line
+                                epg-locale-coding-system))
+                         (epg--clear-string passphrase-with-new-line)
+                         (setq passphrase-with-new-line nil))
+                     (setq encoded-passphrase-with-new-line
+                           passphrase-with-new-line
+                           passphrase-with-new-line nil))
                    (process-send-string (epg-context-process context)
                                         encoded-passphrase-with-new-line)))
              (quit