When I use gnupg like "gpg -es -r Bob filename", the plain text packet contains
the file name encoded in utf-8.
But if I use gnupg like "gpg -e -r Bob filename", I get the file name not
encoded in utf-8.
If I execute "gpg -e -r Bob --set-filename filename filename", I get the file
name encoded in utf-8.
Do you have any reason for this difference ?
I think file names should always be encoded in utf-8.
Without utf8 encoding, the function "make_basename()" may fail to extract base
file name from full path name containing multi-byte charset.
I think you need to modify "encode.c" like below.
- gnupg-1.4.7-orig/g10/encode.c 2006-07-31 18:28:51.000000000 +0900
+++ gnupg-1.4.7/g10/encode.c 2007-06-07 08:48:30.000000000 +0900
@@ -557,22 +557,8 @@
if(use_symkey && (rc=write_symkey_enc(symkey_s2k,symkey_dek,cfx.dek,out))) goto leave;
- if (!opt.no_literal) {
- /* setup the inner packet */
- if( filename || opt.set_filename ) {
- char *s = make_basename( opt.set_filename ? opt.set_filename
- : filename,
- iobuf_get_real_fname( inp ) );
- pt = xmalloc( sizeof *pt + strlen(s) - 1 );
- pt->namelen = strlen(s);
- memcpy(pt->name, s, pt->namelen );
- xfree(s);
- }
- else { /* no filename */
- pt = xmalloc( sizeof *pt - 1 );
- pt->namelen = 0;
- }
- }
+ if (!opt.no_literal)
+ pt = setup_plaintext_name(filename, inp);
if (!iobuf_is_pipe_filename (filename) && *filename && !opt.textmode ) {