Skip to content

Commit f3db606

Browse files
committed
> >
> > a) Write documentation how the win32 console needs to be set up so that > > psql can handle 8-bit characters. > > Where should it be added? The Section "Installation on Windows" in the > > Administrator's Guide seems natural to me. > > > > b) Add code to psql that prints a warning on startup of psql when the > > console codepage differs from the windows codepage, something like > > > > Warning: Console codepage (850) differs from windows codepage (1252) > > 8-bit characters will not work correctly. See PostgreSQL > > documentation "Installation on Windows" for details. > Attached are two patches: - installdoc.patch contains an additional paragraph on the win32 console codepage for the chapter "Installation on Windows" Due to a lack of SGML-tools, I have only edited the text and not tested the SGML code - please check it before merging into the CVS branch. - psqlcodepage.patch adds the warning about a problematic codepage to psql. Christoph Dalitz
1 parent a17b537 commit f3db606

File tree

2 files changed

+60
-2
lines changed

2 files changed

+60
-2
lines changed

doc/src/sgml/install-win32.sgml

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/install-win32.sgml,v 1.12 2003/09/29 18:18:35 momjian Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/install-win32.sgml,v 1.13 2003/09/29 18:21:33 momjian Exp $
33
-->
44

55
<chapter id="install-win32">
@@ -107,6 +107,33 @@ $Header: /cvsroot/pgsql/doc/src/sgml/install-win32.sgml,v 1.12 2003/09/29 18:18:
107107
C++, just right-click on the project and choose to add it.)
108108
</para>
109109

110+
<para>
111+
<application>psql</application> is compiled as a "console application". As
112+
the win32 console windows use a different encoding than the rest of the
113+
system, you must take special care when using 8-bit characaters (eg. german
114+
Umlauts) at the <application>psql</application> prompt. When
115+
<application>psql</application> detects a problematic console codepage, it
116+
will warn you at startup. To change the console codepage, two things are
117+
neccessary:
118+
119+
<variablelist>
120+
<varlistentry>
121+
<listitem>
122+
Set the codepage with <userinput>cmd.exe /c chcp 1252</userinput>
123+
(1252 is the german value, replace it with your value). If you are using
124+
cygwin, you can put this command in <filename>/etc/profile</filename>.
125+
</listitem>
126+
</varlistentry>
127+
<varlistentry>
128+
<listitem>
129+
Set the console font to "Lucida Console", because the raster font
130+
does not work with the ANSI codepage.
131+
</listitem>
132+
</varlistentry>
133+
</variablelist>
134+
135+
</para>
136+
110137
</chapter>
111138

112139
<!-- Keep this comment at the end of the file

src/bin/psql/startup.c

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright (c) 2000-2003, PostgreSQL Global Development Group
55
*
6-
* $Header: /cvsroot/pgsql/src/bin/psql/startup.c,v 1.79 2003/08/07 21:11:58 tgl Exp $
6+
* $Header: /cvsroot/pgsql/src/bin/psql/startup.c,v 1.80 2003/09/29 18:21:33 momjian Exp $
77
*/
88
#include "postgres_fe.h"
99

@@ -80,6 +80,10 @@ static void showVersion(void);
8080
static void printSSLInfo(void);
8181
#endif
8282

83+
#ifdef WIN32
84+
static void
85+
checkWin32Codepage(void);
86+
#endif
8387

8488
/*
8589
*
@@ -269,6 +273,9 @@ main(int argc, char *argv[])
269273
pset.progname, PG_VERSION);
270274
#ifdef USE_SSL
271275
printSSLInfo();
276+
#endif
277+
#ifdef WIN32
278+
checkWin32Codepage();
272279
#endif
273280
}
274281

@@ -621,3 +628,27 @@ printSSLInfo(void)
621628
}
622629

623630
#endif
631+
632+
633+
634+
/*
635+
* checkWin32Codepage
636+
*
637+
* Prints a warning when win32 console codepage differs from Windows codepage
638+
*/
639+
#ifdef WIN32
640+
static void
641+
checkWin32Codepage(void)
642+
{
643+
unsigned int wincp, concp;
644+
645+
wincp = GetACP();
646+
concp = GetConsoleCP();
647+
if (wincp != concp) {
648+
printf("Warning: Console codepage (%u) differs from windows codepage (%u)\n"
649+
" 8-bit characters will not work correctly. See PostgreSQL\n"
650+
" documentation \"Installation on Windows\" for details.\n\n",
651+
concp, wincp);
652+
}
653+
}
654+
#endif

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy