Thanks for the report and the patch. As this results in multiple message boxes (which we create and not Libreoffice) I'll assign it high priority.
I'll take a closer look at the patch tomorrow / test it.
Keep in mind it's just the quick-dummy-workaround patch for my simple gpgme example (https://github.com/egorpugin/examples/blob/master/gpg/gpg.cpp).
Still root case is similar to LibreOffice. You might need to use proper utf8/16 conversion function (maybe they are present in gpgme w32 already) and cover more places with access/_waccess and _A/_W winapi calls.
Well in general we don't support installation into UTF-16 paths for Gpg4win, our installer prevents that. This is probably why this issue never came up.
But what should work and which is the case here is that GPGME is installed in a UTF-16 path. Then it should be able to work with a Gpg4win installed in a local-8bit path.
I've rewritten your patch a bit so that it falls more in line with our general style of helper functions and is more generic.
As I pushed a bit early and only later notices some errors this was spread over mutliple commits. If you want a patch to include in libreoffice here is a combination patch of all commits addressing this issue.
Anglocentrism smells like a relic discrimination in our age of Unicode, let users name folders as they natively see the world. For example, a Greek/Russian/Turkish carpenter with calloused hands, who stores his chisel and hammer in a toolbox, might want to store computer tools like GPG or LibreOffice in a folder Εργαλεία/Инструменты/Araçlar (=Tools), but particular tool unexpectedly says “Error!”, which might be perceived as passive-aggressive “No, I was made to serve the needs of English-speaking celestials only”. Thanks to Andre Heinecke and Egor Pugin for sympathetic attitude and prompt steps to solve this issue.
Dear Andre, LO team is not able to integrate your fix unless a new release of GPGme is ready. Usually you do that every half year or so, but sometimes the delay is much less (e.g. 1.11.0 and 1.11.1). Perhaps, you would find it possible to roll out a minor version of 1.13.0 to ease the suffering of international users a bit earlier?