From 7e5e35ee8c215dbd31ae4320348ff9373f5514eb Mon Sep 17 00:00:00 2001 From: ueno Date: Wed, 7 Mar 2007 23:35:05 +0000 Subject: [PATCH] * epg.el (epg--list-keys-1): Set coding-system-for-read to binary.1 (epg-list-keys): Decode user-id. --- ChangeLog | 2 ++ epg.el | 18 ++++++++++++------ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 172f898..d6ef5a8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,8 @@ * epg.el (epg--start): Don't specify --use-agent if the protocol is CMS; set coding-system-for-read to binary. (epg--status-*SIG): Decode user-id. + (epg--list-keys-1): Set coding-system-for-read to binary.1 + (epg-list-keys): Decode user-id. 2007-02-02 Daiki Ueno diff --git a/epg.el b/epg.el index a3aa5e5..491ef30 100644 --- a/epg.el +++ b/epg.el @@ -1661,6 +1661,7 @@ This function is for internal use only." (unless (eq (epg-context-protocol context) 'CMS) '("--fixed-list-mode")) (if name (list name)))) + (coding-system-for-read 'binary) keys string field index) (with-temp-buffer (apply #'call-process @@ -1704,7 +1705,7 @@ If MODE is t or 'secret, only secret keyring should be searched. Otherwise, only public keyring should be searched and the key signatures should be included." (let ((lines (epg--list-keys-1 context name mode)) - keys cert pointer pointer-1) + keys cert pointer pointer-1 user-id-string) (while lines (cond ((member (aref (car lines) 0) '("pub" "sec" "crt" "crs")) @@ -1724,17 +1725,22 @@ signatures should be included." (cons (epg--make-sub-key-1 (car lines)) (epg-key-sub-key-list (car keys))))) ((equal (aref (car lines) 0) "uid") + (setq user-id-string (if cert + (condition-case nil + (epg-dn-from-string (aref (car lines) 9)) + (error (aref (car lines) 9))) + (aref (car lines) 9))) + (condition-case nil + (setq user-id-string (epg--decode-coding-string user-id-string + 'utf-8)) + (error)) (epg-key-set-user-id-list (car keys) (cons (epg-make-user-id (if (aref (car lines) 1) (cdr (assq (string-to-char (aref (car lines) 1)) epg-key-validity-alist))) - (if cert - (condition-case nil - (epg-dn-from-string (aref (car lines) 9)) - (error (aref (car lines) 9))) - (aref (car lines) 9))) + user-id-string) (epg-key-user-id-list (car keys))))) ((equal (aref (car lines) 0) "fpr") (epg-sub-key-set-fingerprint (car (epg-key-sub-key-list (car keys))) -- 1.7.10.4