Home GnuPG
Diffusion GnuPG edfe9453be5f

w32: Add fallback in case the Windows console can't cope with Unicode.

Description

w32: Add fallback in case the Windows console can't cope with Unicode.

* common/ttyio.c (w32_write_console): Fallback to WriteConsoleA on
error.

To test this switch the Windows Console to "legacy mode"

set LANG=de
gpg --card-edit

and enter an invalid command. The response contains an Umlaut and old
Windows versions (and the legacy console) don't have a proper font
installed for this. Without this patch this runs into a log_fatal
error.

The mitigation we implement is to fallback to WriteConsoleA, that is
accepting wrong encoding and to print a note about the problem.