1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-02 22:46:30 +02:00

gpgtar,w32: Handle Unicode file names.

* tools/gpgtar.c (oUtf8Strings): New.
(opts): Add option --utf8-strings.
(parse_arguments): Set option.
* tools/gpgtar.h (opt): Add field utf8strings.
* tools/gpgtar-create.c (name_to_utf8): New.
(fillup_entry_w32): Use that.
(scan_directory): Ditto.
(scan_directory) [W32]: Convert file name to utf8.
(gpgtar_create): Convert pattern.
--

Note that this works only with file names read from a file or if the
specified files on the command line are plain ascii.  When recursing
into a directory Unicode file names work again.  This limitation is
due to  main(int, char**) which can't get the wchar version.  We could
fix that but is needs a bit more work in our init code.

GnuPG-bug-id: 4083
Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
Werner Koch 2020-08-21 21:28:28 +02:00
parent eec70e539e
commit 34e7703a96
No known key found for this signature in database
GPG key ID: E3FDFF218E45B72B
4 changed files with 68 additions and 10 deletions

View file

@ -75,6 +75,7 @@ enum cmd_and_opt_values
oCMS,
oSetFilename,
oNull,
oUtf8Strings,
/* Compatibility with gpg-zip. */
oGpgArgs,
@ -120,6 +121,12 @@ static gpgrt_opt_t opts[] = {
ARGPARSE_s_s (oFilesFrom, "files-from",
N_("|FILE|get names to create from FILE")),
ARGPARSE_s_n (oNull, "null", N_("-T reads null-terminated names")),
#ifdef HAVE_W32_SYSTEM
ARGPARSE_s_n (oUtf8Strings, "utf8-strings",
N_("-T reads UTF-8 encoded names")),
#else
ARGPARSE_s_n (oUtf8Strings, "utf8-strings", "@"),
#endif
ARGPARSE_s_s (oGpgArgs, "gpg-args", "@"),
ARGPARSE_s_s (oTarArgs, "tar-args", "@"),
@ -325,6 +332,7 @@ parse_arguments (gpgrt_argparse_t *pargs, gpgrt_opt_t *popts)
case oNoVerbose: opt.verbose = 0; break;
case oFilesFrom: files_from = pargs->r.ret_str; break;
case oNull: null_names = 1; break;
case oUtf8Strings: opt.utf8strings = 1; break;
case aList:
case aDecrypt: