Patch of Win32 Encoding problem for server messages using
authorBruce Momjian
Mon, 4 Dec 2006 22:23:40 +0000 (22:23 +0000)
committerBruce Momjian
Mon, 4 Dec 2006 22:23:40 +0000 (22:23 +0000)
FormatMessage() (This should have been in 8.2.0, patched to 8.2.X and
HEAD):

I think this problem to be complex....
http://archives.postgresql.org/pgsql-hackers/2006-11/msg00042.php

FormatMessage of windows cannot consider the encoding of the database.
However, I should try the solution now. It is necessary to clear the
problem.

Multi character-code exists together in message and log. It doesn't
consider
the data base encoding that the user intended....

The user in multi-byte country can try this.
http://inet.winpg.jp/~saito/pg_bug/MessageCheck.c

That is, it is likely to become it in this manner.(Japanese)
http://inet.winpg.jp/~saito/pg_bug/FormatMessage998.png

Hiroshi Saito

src/backend/port/dynloader/win32.c
src/backend/port/win32/socket.c
src/interfaces/libpq/win32.c
src/port/dirmod.c

index 72d27fddcdc4d8c08f8e8e36b5f5d0294c6104d7..980b424b97bfa2f59924666436d4748b719d2051 100644 (file)
@@ -1,4 +1,4 @@
-/* $PostgreSQL: pgsql/src/backend/port/dynloader/win32.c,v 1.8 2006/06/07 22:24:43 momjian Exp $ */
+/* $PostgreSQL: pgsql/src/backend/port/dynloader/win32.c,v 1.9 2006/12/04 22:23:40 momjian Exp $ */
 
 #include "postgres.h"
 
@@ -18,7 +18,7 @@ set_dl_error(void)
                      FORMAT_MESSAGE_FROM_SYSTEM,
                      NULL,
                      err,
-                     MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+                     MAKELANGID(LANG_ENGLISH, SUBLANG_DEFAULT),
                      last_dyn_error,
                      sizeof(last_dyn_error) - 1,
                      NULL) == 0)
index 6489c64daee5942e6d26499c4c7da7b9a0262a15..0dc62a481197d0b19f5f056f9d395d3bd576202a 100644 (file)
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
  *
  * IDENTIFICATION
- *   $PostgreSQL: pgsql/src/backend/port/win32/socket.c,v 1.14 2006/10/13 13:59:47 teodor Exp $
+ *   $PostgreSQL: pgsql/src/backend/port/win32/socket.c,v 1.15 2006/12/04 22:23:40 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -582,7 +582,7 @@ pgwin32_socket_strerror(int err)
    if (FormatMessage(FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_FROM_HMODULE,
                      handleDLL,
                      err,
-                     MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+                     MAKELANGID(LANG_ENGLISH, SUBLANG_DEFAULT),
                      wserrbuf,
                      sizeof(wserrbuf) - 1,
                      NULL) == 0)
index a4ec2ebb70c9849a176d67e51c38b500bbe81c9c..00f0e0073d21d9c5c918c75bdbce320a2b0982bb 100644 (file)
@@ -309,7 +309,7 @@ winsock_strerror(int err, char *strerrbuf, size_t buflen)
        success = 0 != FormatMessage(
                                     flags,
                                     dlls[i].handle, err,
-                                  MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+                                  MAKELANGID(LANG_ENGLISH, SUBLANG_DEFAULT),
                                     strerrbuf, buflen - 64,
                                     0
            );
index 3934b5cf7dd6c40fb8e5e940428d5ab709a7ad22..5f4f97e9c1a683a7604ac842ebbde8d1bb168400 100644 (file)
@@ -10,7 +10,7 @@
  * Win32 (NT, Win2k, XP).  replace() doesn't work on Win95/98/Me.
  *
  * IDENTIFICATION
- *   $PostgreSQL: pgsql/src/port/dirmod.c,v 1.44 2006/11/08 20:12:05 tgl Exp $
+ *   $PostgreSQL: pgsql/src/port/dirmod.c,v 1.45 2006/12/04 22:23:40 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -254,7 +254,7 @@ pgsymlink(const char *oldpath, const char *newpath)
        errno = 0;
        FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
                      NULL, GetLastError(),
-                     MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+                     MAKELANGID(LANG_ENGLISH, SUBLANG_DEFAULT),
                      (LPSTR) & msg, 0, NULL);
 #ifndef FRONTEND
        ereport(ERROR,