2006-09-04  Daiki Ueno  <ueno@unixuser.org>
 
+       * epg-config.el (epg-passphrase-coding-system): New user option.
+
        * epg.el (epg--list-keys-1): Respect epg-gpg-home-directory.
        (epg--clear-string): New function.
        (epg--status-GET_HIDDEN): Encode passphrase with
 
   :group 'epg
   :type '(choice (const :tag "Default" nil) directory))
 
+(defcustom epg-passphrase-coding-system nil
+  "The coding-system used to type passphrases."
+  :group 'epg
+  :type 'symbol)
+
 (defconst epg-version-number "0.0.4")
 
 (defconst epg-gpg-minimum-version "1.4.3")
 
                  (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-passphrase-coding-system
+                       (progn
+                         (setq encoded-passphrase-with-new-line
+                               (encode-coding-string
+                                passphrase-with-new-line
+                                epg-passphrase-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