* GPG --status-fd outputs in UTF-8.
@ 2007-03-07 18:22 Michaël Cadilhac
2007-03-07 22:06 ` Daiki Ueno
0 siblings, 1 reply; 5+ messages in thread
From: Michaël Cadilhac @ 2007-03-07 18:22 UTC (permalink / raw)
To: ding
[-- Attachment #1.1: Type: text/plain, Size: 539 bytes --]
Hi!
It can be read from the DETAILS file of Gnupg the following :
,----
| Format of the "--status-fd" output
| ==================================
| Every line is prefixed with "[GNUPG:] ", followed by a keyword with
| the type of the status line and a some arguments depending on the
| type (maybe none)[...]
| The username is the primary one encoded in UTF-8
`----
To be consistent with the rest of gpg(1)'s output, it would be good to
ask Gnupg to output everything in UTF-8 and treat the buffer as such.
Here's a proposal :
[-- Attachment #1.2: pgg-gpg.patch --]
[-- Type: text/x-patch, Size: 1466 bytes --]
Index: lisp/pgg-gpg.el
===================================================================
RCS file: /usr/local/cvsroot/gnus/lisp/pgg-gpg.el,v
retrieving revision 7.27
diff -B -w -c -r7.27 pgg-gpg.el
*** lisp/pgg-gpg.el 1 Mar 2007 23:43:33 -0000 7.27
--- lisp/pgg-gpg.el 7 Mar 2007 18:09:13 -0000
***************
*** 72,77 ****
--- 72,78 ----
(let* ((output-file-name (pgg-make-temp-file "pgg-output"))
(args
(append (list "--no-tty"
+ "--display-charset" "utf-8"
"--status-fd" "1"
"--command-fd" "0"
"--yes" ; overwrite
***************
*** 101,106 ****
--- 102,108 ----
(setq process
(apply #'start-process "pgg-gpg" buffer pgg-gpg-program args)))
(set-default-file-modes orig-mode))
+ (set-process-coding-system process 'utf-8)
(set-process-filter process #'pgg-gpg-process-filter)
(set-process-sentinel process #'pgg-gpg-process-sentinel)
process))
Index: lisp/ChangeLog
===================================================================
RCS file: /usr/local/cvsroot/gnus/lisp/ChangeLog,v
retrieving revision 7.1503
diff -C0 -r7.1503 ChangeLog
*** lisp/ChangeLog 6 Mar 2007 05:16:37 -0000 7.1503
--- lisp/ChangeLog 7 Mar 2007 18:09:28 -0000
***************
*** 0 ****
--- 1,5 ----
+ 2007-03-07 Michaël Cadilhac <michael@cadilhac.name>
+
+ * pgg-gpg.el (pgg-gpg-start-process): Ask Gnupg to output everything in
+ UTF-8, and treat it as such.
+
[-- Attachment #1.3: Type: text/plain, Size: 434 bytes --]
Thanks in advance ! (Well, I have to admit, I didn't like to see
« Michaël » spelled « Michaël » :-))
--
| Michaël `Micha' Cadilhac | Pour les 35-40 ans, l'humour |
| http://michael.cadilhac.name | c'est une plus-value. |
| JID/MSN: | -- Guillaume L. |
`---- michael.cadilhac@gmail.com | - --'
[-- Attachment #2: Type: application/pgp-signature, Size: 188 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: GPG --status-fd outputs in UTF-8.
2007-03-07 18:22 GPG --status-fd outputs in UTF-8 Michaël Cadilhac
@ 2007-03-07 22:06 ` Daiki Ueno
2007-03-08 1:26 ` Daiki Ueno
2007-03-12 17:28 ` Michaël Cadilhac
0 siblings, 2 replies; 5+ messages in thread
From: Daiki Ueno @ 2007-03-07 22:06 UTC (permalink / raw)
To: Michaël Cadilhac; +Cc: ding
>>>>> In <87ps7k9anj.fsf@lrde.org>
>>>>> michael@cadilhac.name (Michaël Cadilhac) wrote:
> (setq process
> (apply #'start-process "pgg-gpg" buffer pgg-gpg-program args)))
> (set-default-file-modes orig-mode))
> + (set-process-coding-system process 'utf-8)
At least, this change will cause a problem on decryption, if the
plain text is encoded in non-UTF-8 encoding.
BTW, as you might know, PGG is no longer recommended for No Gnus, and
the current primary backend EasyPG handles status-fd output more
precisely, it's easy to make it decode user-id's which only appear on
status lines.
Regards,
--
Daiki Ueno
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: GPG --status-fd outputs in UTF-8.
2007-03-07 22:06 ` Daiki Ueno
@ 2007-03-08 1:26 ` Daiki Ueno
2007-03-12 17:28 ` Michaël Cadilhac
1 sibling, 0 replies; 5+ messages in thread
From: Daiki Ueno @ 2007-03-08 1:26 UTC (permalink / raw)
To: Michaël Cadilhac; +Cc: ding
>>>>> In <526bd3a0-07d1-4009-976f-bf692643d34d@well-done.deisui.org>
>>>>> Daiki Ueno <ueno@unixuser.org> wrote:
> >>>>> In <87ps7k9anj.fsf@lrde.org>
> >>>>> michael@cadilhac.name (Michaël Cadilhac) wrote:
> > (setq process
> > (apply #'start-process "pgg-gpg" buffer pgg-gpg-program args)))
> > (set-default-file-modes orig-mode))
> > + (set-process-coding-system process 'utf-8)
> At least, this change will cause a problem on decryption, if the
> plain text is encoded in non-UTF-8 encoding.
s/decryption/encryption/
Regards,
--
Daiki Ueno
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: GPG --status-fd outputs in UTF-8.
2007-03-07 22:06 ` Daiki Ueno
2007-03-08 1:26 ` Daiki Ueno
@ 2007-03-12 17:28 ` Michaël Cadilhac
2007-03-19 1:21 ` Daiki Ueno
1 sibling, 1 reply; 5+ messages in thread
From: Michaël Cadilhac @ 2007-03-12 17:28 UTC (permalink / raw)
To: Daiki Ueno; +Cc: ding
[-- Attachment #1.1: Type: text/plain, Size: 499 bytes --]
Daiki Ueno <ueno@unixuser.org> writes:
>>>>>> In <87ps7k9anj.fsf@lrde.org>
>>>>>> michael@cadilhac.name (Michaël Cadilhac) wrote:
>> (setq process
>> (apply #'start-process "pgg-gpg" buffer pgg-gpg-program args)))
>> (set-default-file-modes orig-mode))
>> + (set-process-coding-system process 'utf-8)
>
> At least, this change will cause a problem on encryption, if the
> plain text is encoded in non-UTF-8 encoding.
You're right, sorry. Maybe the following?
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: pgg-gpg.patch --]
[-- Type: text/x-patch, Size: 953 bytes --]
--- pgg-gpg.el 02 Mar 2007 00:43:33 +0100 7.27
+++ pgg-gpg.el 12 Mar 2007 18:24:20 +0100
@@ -120,7 +120,7 @@
(beginning-of-line)
(while (looking-at ".*\n") ;the input line is finished
(save-excursion
- (if (looking-at "\\[GNUPG:] \\([A-Z_]+\\)\\>.*")
+ (if (looking-at "\\[GNUPG:] \\([A-Z_]+\\)\\> ?\\(.*\\)")
(let* ((status (match-string 1))
(symbol (intern-soft (concat "pgg-gpg-status-"
status))))
@@ -128,8 +128,12 @@
(setq pgg-gpg-pending-status-list nil))
(if (and symbol
(fboundp symbol))
- (funcall symbol process (buffer-substring
- (match-beginning 1)
- (match-end 0)))))))
+ (funcall symbol process
+ ;; Status value is in UTF-8.
+ (decode-coding-string
+ (encode-coding-string
+ (match-string 2)
+ (car (process-coding-system process)))
+ 'utf-8))))))
(forward-line))
(setq pgg-gpg-read-point (point)))))
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.3: egp.patch --]
[-- Type: text/x-patch, Size: 1374 bytes --]
*** epg.el 2007-01-06 00:43:25.000000000 +0100
--- epg.el 2007-03-12 18:14:05.000000000 +0100
***************
*** 1136,1142 ****
(while (looking-at ".*\n") ;the input line finished
(if (looking-at "\\[GNUPG:] \\([A-Z_]+\\) ?\\(.*\\)")
(let* ((status (match-string 1))
! (string (match-string 2))
(symbol (intern-soft (concat "epg--status-"
status))))
(if (member status epg-pending-status-list)
--- 1136,1147 ----
(while (looking-at ".*\n") ;the input line finished
(if (looking-at "\\[GNUPG:] \\([A-Z_]+\\) ?\\(.*\\)")
(let* ((status (match-string 1))
! ;; Status value is in UTF-8.
! (string (decode-coding-string
! (encode-coding-string
! (match-string 2)
! (car (process-coding-system process)))
! 'utf-8))
(symbol (intern-soft (concat "epg--status-"
status))))
(if (member status epg-pending-status-list)
[-- Attachment #1.4: Type: text/plain, Size: 338 bytes --]
Thanks!
--
| Michaël `Micha' Cadilhac | To be portable, |
| http://michael.cadilhac.name | Just stay on Windows. |
| JID/MSN: | |
`---- michael.cadilhac@gmail.com | -- A Microsoft Guy - --'
[-- Attachment #2: Type: application/pgp-signature, Size: 188 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: GPG --status-fd outputs in UTF-8.
2007-03-12 17:28 ` Michaël Cadilhac
@ 2007-03-19 1:21 ` Daiki Ueno
0 siblings, 0 replies; 5+ messages in thread
From: Daiki Ueno @ 2007-03-19 1:21 UTC (permalink / raw)
To: Michaël Cadilhac; +Cc: ding
>>>>> In <873b4ae5hc.fsf@lrde.org>
>>>>> michael@cadilhac.name (Michaël Cadilhac) wrote:
> [1.3 egp.patch <text/x-patch (7bit)>]
> *** epg.el 2007-01-06 00:43:25.000000000 +0100
> --- epg.el 2007-03-12 18:14:05.000000000 +0100
> ! ;; Status value is in UTF-8.
> ! (string (decode-coding-string
> ! (encode-coding-string
> ! (match-string 2)
> ! (car (process-coding-system process)))
> ! 'utf-8))
I installed a similar change in CVS. The next version of EPG will
display your name correctly :-)
Regards,
--
Daiki Ueno
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2007-03-19 1:21 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-03-07 18:22 GPG --status-fd outputs in UTF-8 Michaël Cadilhac
2007-03-07 22:06 ` Daiki Ueno
2007-03-08 1:26 ` Daiki Ueno
2007-03-12 17:28 ` Michaël Cadilhac
2007-03-19 1:21 ` Daiki Ueno
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).