mirror of
https://github.com/postgres/postgres.git
synced 2025-05-29 00:03:09 -04:00
> >
> > 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
This commit is contained in:
parent
a17b53753e
commit
f3db606592
@ -1,5 +1,5 @@
|
|||||||
<!--
|
<!--
|
||||||
$Header: /cvsroot/pgsql/doc/src/sgml/install-win32.sgml,v 1.12 2003/09/29 18:18:35 momjian Exp $
|
$Header: /cvsroot/pgsql/doc/src/sgml/install-win32.sgml,v 1.13 2003/09/29 18:21:33 momjian Exp $
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<chapter id="install-win32">
|
<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:
|
|||||||
C++, just right-click on the project and choose to add it.)
|
C++, just right-click on the project and choose to add it.)
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
<application>psql</application> is compiled as a "console application". As
|
||||||
|
the win32 console windows use a different encoding than the rest of the
|
||||||
|
system, you must take special care when using 8-bit characaters (eg. german
|
||||||
|
Umlauts) at the <application>psql</application> prompt. When
|
||||||
|
<application>psql</application> detects a problematic console codepage, it
|
||||||
|
will warn you at startup. To change the console codepage, two things are
|
||||||
|
neccessary:
|
||||||
|
|
||||||
|
<variablelist>
|
||||||
|
<varlistentry>
|
||||||
|
<listitem>
|
||||||
|
Set the codepage with <userinput>cmd.exe /c chcp 1252</userinput>
|
||||||
|
(1252 is the german value, replace it with your value). If you are using
|
||||||
|
cygwin, you can put this command in <filename>/etc/profile</filename>.
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
|
<varlistentry>
|
||||||
|
<listitem>
|
||||||
|
Set the console font to "Lucida Console", because the raster font
|
||||||
|
does not work with the ANSI codepage.
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
|
</variablelist>
|
||||||
|
|
||||||
|
</para>
|
||||||
|
|
||||||
</chapter>
|
</chapter>
|
||||||
|
|
||||||
<!-- Keep this comment at the end of the file
|
<!-- Keep this comment at the end of the file
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright (c) 2000-2003, PostgreSQL Global Development Group
|
* Copyright (c) 2000-2003, PostgreSQL Global Development Group
|
||||||
*
|
*
|
||||||
* $Header: /cvsroot/pgsql/src/bin/psql/startup.c,v 1.79 2003/08/07 21:11:58 tgl Exp $
|
* $Header: /cvsroot/pgsql/src/bin/psql/startup.c,v 1.80 2003/09/29 18:21:33 momjian Exp $
|
||||||
*/
|
*/
|
||||||
#include "postgres_fe.h"
|
#include "postgres_fe.h"
|
||||||
|
|
||||||
@ -80,6 +80,10 @@ static void showVersion(void);
|
|||||||
static void printSSLInfo(void);
|
static void printSSLInfo(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
static void
|
||||||
|
checkWin32Codepage(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
@ -269,6 +273,9 @@ main(int argc, char *argv[])
|
|||||||
pset.progname, PG_VERSION);
|
pset.progname, PG_VERSION);
|
||||||
#ifdef USE_SSL
|
#ifdef USE_SSL
|
||||||
printSSLInfo();
|
printSSLInfo();
|
||||||
|
#endif
|
||||||
|
#ifdef WIN32
|
||||||
|
checkWin32Codepage();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -621,3 +628,27 @@ printSSLInfo(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* checkWin32Codepage
|
||||||
|
*
|
||||||
|
* Prints a warning when win32 console codepage differs from Windows codepage
|
||||||
|
*/
|
||||||
|
#ifdef WIN32
|
||||||
|
static void
|
||||||
|
checkWin32Codepage(void)
|
||||||
|
{
|
||||||
|
unsigned int wincp, concp;
|
||||||
|
|
||||||
|
wincp = GetACP();
|
||||||
|
concp = GetConsoleCP();
|
||||||
|
if (wincp != concp) {
|
||||||
|
printf("Warning: Console codepage (%u) differs from windows codepage (%u)\n"
|
||||||
|
" 8-bit characters will not work correctly. See PostgreSQL\n"
|
||||||
|
" documentation \"Installation on Windows\" for details.\n\n",
|
||||||
|
concp, wincp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user