mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
w32: Always use Unicode for console input and output.
* common/init.c (_init_common_subsystems) [W32]: Set the codepage to
UTF-8 for input and putput. Switch gettext to UTF-8.
* g10/gpg.c (utf8_strings) [W32]: Make sure this is always set.
--
With this patch the former patch to use ReadConsoleW and WriteConsoleW
in ttyio.c are kind of superfluous because the ANSI version of these
functions are also able to read/write UTF-8 directly given the console
code page has been set correctly. However, this seems to work only
with recent versions of Windows-10.
GnuPG-bug-id: 4365
(cherry picked from commit 8c41b8aac3
)
Removed changes for "gpgconf --show-codepages" of the original patch.
This commit is contained in:
parent
ebdb62a98a
commit
b912f07cdf
3 changed files with 36 additions and 8 deletions
|
@ -202,6 +202,17 @@ _init_common_subsystems (gpg_err_source_t errsource, int *argcp, char ***argvp)
|
|||
parse_std_file_handles (argcp, argvp);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_W32_SYSTEM
|
||||
/* We want gettext to always output UTF-8 and we put the console in
|
||||
* utf-8 mode. */
|
||||
gettext_use_utf8 (1);
|
||||
if (!SetConsoleCP (CP_UTF8) || !SetConsoleOutputCP (CP_UTF8))
|
||||
{
|
||||
log_info ("SetConsoleCP failed: %s\n", w32_strerror (-1));
|
||||
log_info ("Warning: Garbled console data possible\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Access the standard estreams as early as possible. If we don't
|
||||
do this the original stdio streams may have been closed when
|
||||
_es_get_std_stream is first use and in turn it would connect to
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue