server , client encoding issue

Started by surabhi.ahujaover 20 years ago7 messagesgeneral
Jump to latest
#1surabhi.ahuja
surabhi.ahuja@iiitb.ac.in

hi all

i am facing a problem and here it is:

i install the following (postgres) rpms as root
postgresql-libs-8.0.0-1PGDG.i686.rpm
postgresql-8.0.0-1PGDG.i686.rpm
and
postgresql-server-8.0.0-1PGDG.i686.rpm

now i try to create a database

/usr/bin/createdb temp

when i connect to it
it shows: server_encoding : LATIN9
and client_encoding: LATIN9

from where did it get these values
i want them to be UNICODE.

please help
( i know there is a workaround to this problem -
/usr/bin/createdb -E UNICODE temp )

but this is happening at a particular machine . On other machines it is UNICODE.

thanks
regards
surabhi

#2surabhi.ahuja
surabhi.ahuja@iiitb.ac.in
In reply to: surabhi.ahuja (#1)
Re: server , client encoding issue

how can i check my environment ? i mean the locale settings?

________________________________

From: Richard Huxton [mailto:dev@archonet.com]
Sent: Tue 10/18/2005 6:04 PM
To: surabhi.ahuja
Cc: pgsql-general@postgresql.org
Subject: Re: [GENERAL] server , client encoding issue

***********************
Your mail has been scanned by InterScan VirusWall.
***********-***********

surabhi.ahuja wrote:

when i connect to it
it shows: server_encoding : LATIN9
and client_encoding: LATIN9

from where did it get these values

From your environment - the machine is presumably defaulting to some
locale that uses LATIN9 for it's character-set.

i want them to be UNICODE.

please help
( i know there is a workaround to this problem -
/usr/bin/createdb -E UNICODE temp )

but this is happening at a particular machine . On other machines it is UNICODE.

It's not really a workaround - I always specify encoding for the
databases I create (precisely to avoid this sort of problem).

--
Richard Huxton
Archonet Ltd

#3surabhi.ahuja
surabhi.ahuja@iiitb.ac.in
In reply to: surabhi.ahuja (#2)
Re: server , client encoding issue

i checked the locale it is giving:

LANG=en_US.iso885915
LC_CTYPE="en_US.iso885915"
LC_NUMERIC=en_US
LC_TIME="en_US.iso885915"
LC_COLLATE="en_US.iso885915"
LC_MONETARY="en_US.iso885915"
LC_MESSAGES="en_US.iso885915"
LC_PAPER="en_US.iso885915"
LC_NAME="en_US.iso885915"
LC_ADDRESS="en_US.iso885915"
LC_TELEPHONE="en_US.iso885915"
LC_MEASUREMENT="en_US.iso885915"
LC_IDENTIFICATION="en_US.iso885915"
LC_ALL=

is it "lang" that is "LATIN9"

________________________________

From: Richard Huxton [mailto:dev@archonet.com]
Sent: Tue 10/18/2005 6:04 PM
To: surabhi.ahuja
Cc: pgsql-general@postgresql.org
Subject: Re: [GENERAL] server , client encoding issue

***********************
Your mail has been scanned by InterScan VirusWall.
***********-***********

surabhi.ahuja wrote:

when i connect to it
it shows: server_encoding : LATIN9
and client_encoding: LATIN9

from where did it get these values

From your environment - the machine is presumably defaulting to some
locale that uses LATIN9 for it's character-set.

i want them to be UNICODE.

please help
( i know there is a workaround to this problem -
/usr/bin/createdb -E UNICODE temp )

but this is happening at a particular machine . On other machines it is UNICODE.

It's not really a workaround - I always specify encoding for the
databases I create (precisely to avoid this sort of problem).

--
Richard Huxton
Archonet Ltd

#4Richard Huxton
dev@archonet.com
In reply to: surabhi.ahuja (#3)
Re: server , client encoding issue

surabhi.ahuja wrote:

i checked the locale it is giving:

LANG=en_US.iso885915
LC_CTYPE="en_US.iso885915"

If you Google for "ISO-8859-15 Latin9" the top two results seem to give
details. Oh - there are two naming systems for character sets, just to
make things even more complicated.

Now, traditionally you'd have used Latin1 (ISO-8859-1), but the
introduction of the Euro meant they needed to introduce a new character.
They took the opportunity to make some other changes too and called the
results Latin9 (ISO-8859-15).

OK - now the original problem was with a database not having a UNICODE
encoding. It does look like this is because the environment on this
machine is Latin9 rather than UTF-8. It's easy to have this problem, and
I always recommend setting the encoding explicitly when creating a
database cluster (initdb --encoding=UTF8). If you installed from a
package, it might have chosen a default for you though.

HTH
--
Richard Huxton
Archonet Ltd

#5surabhi.ahuja
surabhi.ahuja@iiitb.ac.in
In reply to: Richard Huxton (#4)
Re: server , client encoding issue

how can i change the client encoding to LATIN1?
i know it can be done by changing the postgresql.conf

but i want to include it in the code ...

is it possible that PQconnectdb can take a parameter for client encoding if yes how??

if PQconnectdb can not handle it ..please tell as to how which is the method i can use for doing the above

________________________________

From: Richard Huxton [mailto:dev@archonet.com]
Sent: Thu 10/20/2005 1:00 PM
To: surabhi.ahuja
Cc: pgsql-general@postgresql.org
Subject: Re: [GENERAL] server , client encoding issue

***********************
Your mail has been scanned by InterScan VirusWall.
***********-***********

surabhi.ahuja wrote:

i checked the locale it is giving:

LANG=en_US.iso885915
LC_CTYPE="en_US.iso885915"

If you Google for "ISO-8859-15 Latin9" the top two results seem to give
details. Oh - there are two naming systems for character sets, just to
make things even more complicated.

Now, traditionally you'd have used Latin1 (ISO-8859-1), but the
introduction of the Euro meant they needed to introduce a new character.
They took the opportunity to make some other changes too and called the
results Latin9 (ISO-8859-15).

OK - now the original problem was with a database not having a UNICODE
encoding. It does look like this is because the environment on this
machine is Latin9 rather than UTF-8. It's easy to have this problem, and
I always recommend setting the encoding explicitly when creating a
database cluster (initdb --encoding=UTF8). If you installed from a
package, it might have chosen a default for you though.

HTH
--
Richard Huxton
Archonet Ltd

#6Martijn van Oosterhout
kleptog@svana.org
In reply to: surabhi.ahuja (#5)
Re: server , client encoding issue

On Thu, Oct 20, 2005 at 03:41:51PM +0530, surabhi.ahuja wrote:

how can i change the client encoding to LATIN1?
i know it can be done by changing the postgresql.conf

Send the query:

set client_encoding=latin1;

Have a nice day,

--
Martijn van Oosterhout <kleptog@svana.org> http://svana.org/kleptog/

Show quoted text

Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
tool for doing 5% of the work and then sitting around waiting for someone
else to do the other 95% so you can sue them.

#7Tom Lane
tgl@sss.pgh.pa.us
In reply to: Martijn van Oosterhout (#6)
Re: server , client encoding issue

Martijn van Oosterhout <kleptog@svana.org> writes:

On Thu, Oct 20, 2005 at 03:41:51PM +0530, surabhi.ahuja wrote:

how can i change the client encoding to LATIN1?

Send the query:
set client_encoding=latin1;

Also, whatever client-side library you're using may have alternative
ways to specify the same thing. libpq for instance looks for a
PGCLIENTENCODING environment variable.

regards, tom lane