mirror of
https://github.com/postgres/postgres.git
synced 2025-12-10 14:22:35 +03:00
here are the patches for psql on Win32:
psql4win32.patch - changes in the psql source code
psql-ref.patch - changes in the documentation psql-ref.sgml
(for new builtin variable WIN32_CONSOLE)
To apply them use "patch -p 1" in the root directory of the
postgres source directory.
These patches fix the following problems of psql on Win32
(all changes only have effect #ifdef WIN32):
a) Problem: Static library libpq.a did not work
Solution: Added WSAStartup() in fe-connect.c
b) Problem: Secret Password was echoed by psql
Solution: Password echoing disabled in sprompt.c
c) Problem: 8bit characters were displayed/interpreted wrong in psql
This is due to the fact that the Win32 "console" uses a
different encoding than the rest of the Windows system
Solution: Introduced a new psql variable WIN32_CONSOLE
When set with "\set WIN32_console", the function OemToChar()
is applied after reading input and CharToOem() before
displaying Output
Christoph Dalitz
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Copyright 2000 by PostgreSQL Global Development Group
|
||||
*
|
||||
* $Header: /cvsroot/pgsql/src/bin/psql/mbprint.c,v 1.6 2003/03/18 22:15:44 petere Exp $
|
||||
* $Header: /cvsroot/pgsql/src/bin/psql/mbprint.c,v 1.7 2003/07/27 03:32:26 momjian Exp $
|
||||
*/
|
||||
|
||||
#include "postgres_fe.h"
|
||||
@@ -11,6 +11,10 @@
|
||||
|
||||
#include "mb/pg_wchar.h"
|
||||
|
||||
#ifdef WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* This is an implementation of wcwidth() and wcswidth() as defined in
|
||||
* "The Single UNIX Specification, Version 2, The Open Group, 1997"
|
||||
@@ -330,6 +334,14 @@ mbvalidate(unsigned char *pwcs, int encoding)
|
||||
return mb_utf_validate(pwcs);
|
||||
else
|
||||
{
|
||||
#ifdef WIN32
|
||||
/*
|
||||
* translate characters to DOS console encoding, e.g. needed
|
||||
* for German umlauts
|
||||
*/
|
||||
if (GetVariableBool(pset.vars, "WIN32_CONSOLE"))
|
||||
CharToOem(pwcs, pwcs);
|
||||
#endif
|
||||
/*
|
||||
* other encodings needing validation should add their own
|
||||
* routines here
|
||||
|
||||
Reference in New Issue
Block a user