[Gpg4win-commits] [git] Gpg4win - branch, master, updated. gpg4win-2.2.1-42-geffddf3

by Andre Heinecke cvs at cvs.gnupg.org
Tue Aug 26 09:51:18 CEST 2014


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GnuPG for Windows".

The branch, master has been updated
       via  effddf379e5aa038449fb17e4f757cf464d217a2 (commit)
      from  890e4dcf411e41502bd338f5fab9d724330fd50b (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit effddf379e5aa038449fb17e4f757cf464d217a2
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Tue Aug 26 09:50:24 2014 +0200

    Add patch to fix encoding problems with console
    
        * NEWS: Mention this fix.
        * patches/gnupg2-2.0.26/
        0002-Let-wchar_to_native-convert-to-console-codepage.patch: New.
    
    --
        The related bugs are mentioned in the patch.

diff --git a/NEWS b/NEWS
index 0a39508..8a3ee99 100644
--- a/NEWS
+++ b/NEWS
@@ -45,6 +45,11 @@ Noteworthy changes in version 2.2.2 (unreleased)
      in GpgOL behoben. Insbesondere bei der Verwendung von Microsoft
      Exchange Addressbüchern.
 
+(en) Command line output is now encoded to the Windows console encoding.
+
+(de) Kommandozeilen Ausgaben werden nun im zur Windows Konsole passenden
+     Encoding ausgegeben.
+
 ~~~~~~~~~~~~~~~
 GnuPG:          2.0.26
 Kleopatra:      2.2.0-gitac229d2
diff --git a/patches/gnupg2-2.0.26/0002-Let-wchar_to_native-convert-to-console-codepage.patch b/patches/gnupg2-2.0.26/0002-Let-wchar_to_native-convert-to-console-codepage.patch
new file mode 100755
index 0000000..4765cd2
--- /dev/null
+++ b/patches/gnupg2-2.0.26/0002-Let-wchar_to_native-convert-to-console-codepage.patch
@@ -0,0 +1,67 @@
+#! /bin/sh
+patch -p1 -l -f $* < $0
+exit $?
+
+From ba62c8e78bc4d14cfe8c69928ec10fa14e8c6cd8 Mon Sep 17 00:00:00 2001
+From: Andre Heinecke <aheinecke at intevation.de>
+Date: Thu, 21 Aug 2014 12:05:12 +0200
+Subject: [PATCH] Let wchar_to_native convert to console codepage
+
+    * jnlib/w32-gettext.c (wchar_to_native): Use GetConsoleOutputCP.
+
+--
+    Just using CP_ACP does not neccessarily convert to the correct
+    codepage as codepages might differ between ConsoleOutput and
+    GUI output (which it usually does).
+
+    GnuPG-bug-id: 1691, 1373, 1674
+---
+ jnlib/w32-gettext.c | 19 +++++++++++++++----
+ 1 file changed, 15 insertions(+), 4 deletions(-)
+
+diff --git a/jnlib/w32-gettext.c b/jnlib/w32-gettext.c
+index 14cb1e1..a1b7e90 100644
+--- a/jnlib/w32-gettext.c
++++ b/jnlib/w32-gettext.c
+@@ -1299,7 +1299,7 @@ utf8_to_wchar (const char *string, size_t length, size_t *retlen)
+ }
+
+
+-/* Return a malloced string encoded in UTF-8 from the wide char input
++/* Return a malloced string encoded for the native codepage from the wide char input
+    string STRING.  Caller must free this value. On failure returns
+    NULL.  The result of calling this function with STRING set to NULL
+    is not defined. */
+@@ -1308,8 +1308,19 @@ wchar_to_native (const wchar_t *string, size_t length, size_t *retlen)
+ {
+   int n;
+   char *result;
+-
+-  n = WideCharToMultiByte (CP_ACP, 0, string, length, NULL, 0, NULL, NULL);
++  /* We are a console program thus we need to use the
++   GetConsoleOutputCP function and not the the GetACP which
++   would give the codepage for a GUI program.  Note this is not
++   a bulletproof detection because GetConsoleCP might return a
++   different one for console input.  Not sure how to cope with
++   that.  If the console Code page is not known we fall back to
++   the system code page. This is how utf8conv does resolve this. */
++  unsigned int cpno = GetConsoleOutputCP ();
++
++  if (!cpno)
++    cpno = GetACP ();
++
++  n = WideCharToMultiByte (cpno, 0, string, length, NULL, 0, NULL, NULL);
+   if (n < 0 || (n+1) <= 0)
+     return NULL;
+
+@@ -1317,7 +1328,7 @@ wchar_to_native (const wchar_t *string, size_t length, size_t *retlen)
+   if (!result)
+     return NULL;
+
+-  n = WideCharToMultiByte (CP_ACP, 0, string, length, result, n, NULL, NULL);
++  n = WideCharToMultiByte (cpno, 0, string, length, result, n, NULL, NULL);
+   if (n < 0)
+     {
+       jnlib_free (result);
+--
+1.9.1

-----------------------------------------------------------------------

Summary of changes:
 NEWS                                               |    5 ++
 ...har_to_native-convert-to-console-codepage.patch |   67 ++++++++++++++++++++
 2 files changed, 72 insertions(+)
 create mode 100755 patches/gnupg2-2.0.26/0002-Let-wchar_to_native-convert-to-console-codepage.patch


hooks/post-receive
-- 
GnuPG for Windows
http://git.gnupg.org



More information about the Gpg4win-commits mailing list