On 12/18/04 at 14:58:47 Dimitry Andric wrote: > Hm, a temp workaround I found is to delete (or move away) any > instances of "iconv.dll" in your PATH. It turns out the new GPG tries > to load this if available, and something goes wrong with it, but I'm > not sure what.
Now I think I've found out what goes wrong: The Bat's way of starting a console process seems to cause the console's code page to be undefined. GPG uses the Win32 API call GetConsoleOutputCP() to retrieve it, but it returns 0 (you might consider that return value an indication of failure :). I've added some comments about this to the bug report here: https://www.ritlabs.com/bt/view.php?id=4173 For GPG it might be a workaround to additionally use GetOEMCP(), if GetConsoleOutputCP() returns 0. A simple patch for this is attached.
diff -urNd gnupg-1.4.0/util/strgutil.c gnupg-1.4.0-cpfix/util/strgutil.c
--- gnupg-1.4.0/util/strgutil.c Wed Nov 17 16:50:58 2004
+++ gnupg-1.4.0-cpfix/util/strgutil.c Sat Dec 18 16:07:38 2004
@@ -478,23 +478,29 @@
if (!newset) {
#ifdef _WIN32
- static char codepage[30];
-
/* We are a console program thus we need to use the
GetConsoleOutputCP fucntion and not the the GetACP which
would give the codepage for a GUI program. Note this is
not a bulletproof detection because GetConsoleCP might
retrun a different one for console input. Not sure how to
cope with that. */
- sprintf (codepage, "CP%u", (unsigned int)GetConsoleOutputCP ());
+ unsigned int cp = (unsigned int)GetConsoleOutputCP ();
+ /* If we're started from a GUI program, the console codepage
+ might not be set. In this case, just try using the current
+ OEM codepage for the system. */
+ if (!cp)
+ cp = (unsigned int)GetOEMCP();
/* If it is the Windows name for Latin-1 we use the standard
name instead to avoid loading of iconv.dll. Unfortunately
it is often CP850 and we don't have a custom translation
for it. */
- if (!strcmp (codepage, "CP1252"))
+ if (cp == 1252)
newset = "iso-8859-1";
- else
+ else {
+ static char codepage[30];
+ sprintf (codepage, "CP%u", cp);
newset = codepage;
+ }
#else
#ifdef HAVE_LANGINFO_CODESET
newset = nl_langinfo (CODESET);
pgp06gOIXHrot.pgp
Description: PGP signature
________________________________________________________ Current beta is 3.0.2.10 | 'Using TBBETA' information: http://www.silverstones.com/thebat/TBUDLInfo.html IMPORTANT: To register as a Beta tester, use this link first - http://www.ritlabs.com/en/partners/testers/

