pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
encoding problem
6+ messages / 5 participants
[nested] [flat]

* encoding problem
@ 2003-02-19 12:00  Nathalie Boulos <nathalieboulos@hotmail.com>
  0 siblings, 0 replies; 6+ messages in thread

From: Nathalie Boulos @ 2003-02-19 12:00 UTC (permalink / raw)
  To: pgsql-admin

Hello,

I am testing Win2k clients in reading/writing arabic in Postgres DB via web 
(apache with scripts written in PHP).

I have 2 PostgreSQL DB created with -E unicode:
One on RH linux 7.1 (postgresql-7.0.3-8) (CASE 1)
The other on RH linux 8.0 (postgres-7.2.2-1)  (CASE 2)

In case 1, a win2k client writes to a postgres7.0 DB and the arabic letters 
can clearly be read in "psql" and on the web.

In case 2, a win2k client writes to the 7.2 postgres, the arabic input is in 
psql:

test=# select * from ttest;
  nom_fr   |        nom_ar
-----------+-----------------------
nathalie  |                          //invisible when no charset defined in 
web page
nathalie  |
nathalie1 |
latino    |
dfww      | &#1576;&#1610;&#1576;   //has this format when charset=UTF8
dfww      | &#1576;&#1610;&#1576;
(6 rows)


Is that related to the automatic conversion in postgres7.2?

When i get the &#xxxx; format, each letter is consuming 7 caracters in the 
database!

I cannot understand the difference btw the 2 versions of postgres.
I would greatly appreciate any help.
and what should i do to see the arabic letters in the version 7.2?

Thank you in advance.

Regards
Nathalie





_________________________________________________________________
Add photos to your messages with MSN 8. Get 2 months FREE*. 
http://join.msn.com/?page=features/featuredemail




^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* encoding problem
@ 2003-03-25 06:07  Alexey A. Britchko <beholder@roaddep.ru>
  0 siblings, 1 reply; 6+ messages in thread

From: Alexey A. Britchko @ 2003-03-25 06:07 UTC (permalink / raw)
  To: pgsql-admin

Hi there

How did upgrade from pgsql 6.x to pgsql 7.x:
1. Dumped database
2. ./configure --enable-locale --enable-multibyte=WIN; make; make
install;
3. Killed postmaster daemon
3. rm -rf /usr/local/pgsql/data; mkdir /usr/local/pgsql/data; chown
postgres /usr/local/pgsql/data;
4. /usr/local/pgsql/bin/initdb -E WIN -D /usr/local/pgsql/data
5. Started postmaster daemon
6. Restored database from dbdump file.

What i've got now:

$ /usr/local/pgsql/bin/psql -l
        List of databases
   Name    |  Owner   | Encoding  
-----------+----------+-----------
 dcl       | raven    | SQL_ASCII
 dragons   | raven    | SQL_ASCII
 postgres  | postgres | SQL_ASCII
 template0 | postgres | WIN
 template1 | postgres | WIN
 test      | postgres | SQL_ASCII
(6 rows)

The default encoding for 4 of databases is SQL_ASCII. Well, that's OK.
The database encoding is shure to be described in the dump file. And
it seems to be restored correctly.

But now when I make selections, I get data in the SQL_ASCII (a think
so) encoding instead of WIN (WIN1251). Before PostgreSQL upgrade
everything were working correctly.

The questions:
1. What happens with the database encoding when I do pg_dumpall ?
2. How can I permanently switch database encoding without
database re-initialization? If I can't, how can I do that with DB
re-initialization?

-- 
Best regards,
 Alexey                          mailto:beholder@roaddep.ru




^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: encoding problem
@ 2003-03-25 08:16  Fouad Fezzi <Fouad.Fezzi@iup.univ-avignon.fr>
  parent: Alexey A. Britchko <beholder@roaddep.ru>
  0 siblings, 0 replies; 6+ messages in thread

From: Fouad Fezzi @ 2003-03-25 08:16 UTC (permalink / raw)
  To: Alexey A. Britchko <beholder@roaddep.ru>; pgsql-admin



-----Message d'origine-----
De : pgsql-admin-owner@postgresql.org
[mailto:pgsql-admin-owner@postgresql.org]De la part de Alexey A.
Britchko
Envoye : mardi 25 mars 2003 07:08
A : pgsql-admin@postgresql.org
Objet : [ADMIN] encoding problem


Hi there

How did upgrade from pgsql 6.x to pgsql 7.x:
1. Dumped database
2. ./configure --enable-locale --enable-multibyte=WIN; make; make
install;
3. Killed postmaster daemon
3. rm -rf /usr/local/pgsql/data; mkdir /usr/local/pgsql/data; chown
postgres /usr/local/pgsql/data;
4. /usr/local/pgsql/bin/initdb -E WIN -D /usr/local/pgsql/data
5. Started postmaster daemon
6. Restored database from dbdump file.

What i've got now:

$ /usr/local/pgsql/bin/psql -l
        List of databases
   Name    |  Owner   | Encoding  
-----------+----------+-----------
 dcl       | raven    | SQL_ASCII
 dragons   | raven    | SQL_ASCII
 postgres  | postgres | SQL_ASCII
 template0 | postgres | WIN
 template1 | postgres | WIN
 test      | postgres | SQL_ASCII
(6 rows)

The default encoding for 4 of databases is SQL_ASCII. Well, that's OK.
The database encoding is shure to be described in the dump file. And
it seems to be restored correctly.

But now when I make selections, I get data in the SQL_ASCII (a think
so) encoding instead of WIN (WIN1251). Before PostgreSQL upgrade
everything were working correctly.

The questions:
1. What happens with the database encoding when I do pg_dumpall ?
It seem to me that upgrade postrgesql database get data in SQL_ASCII
2. How can I permanently switch database encoding without
database re-initialization? If I can't, how can I do that with DB
re-initialization?
Here what i do when automatic upgrade dont't work
a_ createdb -E select-your-favorite-encoding database
b_ psql -d database -f dump.data

Hope that help

-- 
Best regards,
 Alexey                          mailto:beholder@roaddep.ru


---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
    (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)




^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Encoding Problem
@ 2011-09-12 11:38  Mokhtary, Mandana <mandana.mokhtary@wspgroup.se>
  0 siblings, 1 reply; 6+ messages in thread

From: Mokhtary, Mandana @ 2011-09-12 11:38 UTC (permalink / raw)
  To: pgsql-admin

 

Hi

I am trying to load shapfiles into the postgreSQL9.0. The database encoding is UTF8.

My shapfiles coming from Sweden, so there are some Swedish alphabet in the fields name and also inside columns data.

 

I used this command to load shapfiles:

C:\Pragram Files\PostgreSQL\9.0> shp2pgsql -s 2400 -c -W LATIN1 C:/project/Mandana/OBO/WSPbackground_shp/Primärkartan.shp |psql -U postgres OBO

 

I could insert shapfiles which do not have Swedish alphabet in their fields name or data inside the columns, but I could not load others that have Swedish alphabet.

I get this ERROR:

 

invalid byte sequence for encoding "UTF8":0xe4726b

 

Any help would be so appreciated.

Vänliga hälsningar

Mandana Mokhtary
Geografisk IT och mätningsteknik




WSP Samhällsbyggnad
SE-121 88  Stockholm-Globen
Besök/visit: Arenavägen 7
Tel/phone: +46 (0)8 688 60 00
Fax: +46 (0)8 688 69 99
Mobil/mobile: +46 (0)70 297 48 10
www.wspgroup.se <http://www.wspgroup.se/; 

WSP är ett globalt analys- och teknikföretag som erbjuder konsulttjänster för hållbar samhällsutveckling inom Hus & Industri, Transport & Infrastruktur samt Miljö & Energi. 

CONFIDENTIAL 
This e-mail is confidential to the named recipient. If you have received a copy in error, please destroy it. You may not use or disclose the contents of this e-mail to anyone, nor take copies of it. The only copies permitted are (1) by the named recipient and (2) for the purposes of completing successful electronic transmission to the named recipient and then only on the condition that these copies, with this notice attached, are kept confidential until destruction.

 

 

^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Encoding Problem
@ 2011-09-12 11:55  Florian Helmberger <fh@25th-floor.com>
  parent: Mokhtary, Mandana <mandana.mokhtary@wspgroup.se>
  0 siblings, 0 replies; 6+ messages in thread

From: Florian Helmberger @ 2011-09-12 11:55 UTC (permalink / raw)
  To: pgsql-admin; +Cc: mandana.mokhtary@wspgroup.se

On 12.09.11 13:38, Mokhtary, Mandana wrote:

> I am trying to load shapfiles into the postgreSQL9.0. The database
> encoding is UTF8.
>
> My shapfiles coming from Sweden, so there are some Swedish alphabet in
> the fields name and also inside columns data.
>
> I used this command to load shapfiles:
>
> C:\Pragram Files\PostgreSQL\9.0> shp2pgsql -s 2400 –c –W LATIN1
> C:/project/Mandana/OBO/WSPbackground_shp/Primärkartan.shp |psql –U
> postgres OBO
>
> I could insert shapfiles which do not have Swedish alphabet in their
> fields name or data inside the columns, but I could not load others that
> have Swedish alphabet.
>
> I get this ERROR:
>
> *invalid byte sequence for encoding “UTF8”:0xe4726b*
>
> Any help would be so appreciated.

Hi!

You might need to set the CLIENT_ENCODING to latin1.

http://www.postgresql.org/docs/9.0/static/multibyte.html

Regards,
Florian

-- 

Florian Helmberger --------------------

25th-floor - Operating Custom Solutions
de Pretis & Helmberger KG

Seidengasse 33-35/Top 19
1070 Wien, Austria

Mail: fh@25th-floor.com
Web : http://www.25th-floor.com
Tel.: +43 1 / 512 82 89 - 60
Fax : +43 1 / 512 82 89 - 76
Mob.: +43 699 / 109 24 24 5
---------------------------------------



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* encoding problem
@ 2011-09-14 05:37  Mokhtary, Mandana <mandana.mokhtary@wspgroup.se>
  0 siblings, 0 replies; 6+ messages in thread

From: Mokhtary, Mandana @ 2011-09-14 05:37 UTC (permalink / raw)
  To: pgsql-admin

 

Hi All

 

I was trying to load shapfiles into the postgre9, then I used this command:

C:\Program Files\PostgreSQL\9.0>shp2pgsql -s 2400 -c -W LATIN1 C:/Projects/Mandana/OBO/WSPBakgrund_shp/Primärkartan.shp | psql -U postgres OBO

 

Then I had a UTF encoding problem. (invalid byte sequence for encoding UTF8)

 

Then I followed these steps in order to set client encoding:

1. shp2pgsql -s 2400 -c -W LATIN1
C:/Projects/Mandana/OBO/WSPBakgrund_shp/Primärkartan.shp > data.sql

this creates the data.sql with the results of shp2pgsql.

2. psql -U postgres OBO

this connects you to our database.

3. set client_encoding to latin1;

this sets the client_encoding.

4. \i data.sql

this executes the generated data.sql file

But, can anyone tell me how can I insert the data.sql into the postgres? Does it contain shapfiles?

Any help would be appreciated.

Vänliga hälsningar

Mandana Mokhtary
Geografisk IT och mätningsteknik




WSP Samhällsbyggnad
SE-121 88  Stockholm-Globen
Besök/visit: Arenavägen 7
Tel/phone: +46 (0)8 688 60 00
Fax: +46 (0)8 688 69 99
Mobil/mobile: +46 (0)70 297 48 10
www.wspgroup.se <http://www.wspgroup.se/; 

WSP är ett globalt analys- och teknikföretag som erbjuder konsulttjänster för hållbar samhällsutveckling inom Hus & Industri, Transport & Infrastruktur samt Miljö & Energi. 

CONFIDENTIAL 
This e-mail is confidential to the named recipient. If you have received a copy in error, please destroy it. You may not use or disclose the contents of this e-mail to anyone, nor take copies of it. The only copies permitted are (1) by the named recipient and (2) for the purposes of completing successful electronic transmission to the named recipient and then only on the condition that these copies, with this notice attached, are kept confidential until destruction.

 

 

^ permalink  raw  reply  [nested|flat] 6+ messages in thread


end of thread, other threads:[~2011-09-14 05:37 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-02-19 12:00 encoding problem Nathalie Boulos <nathalieboulos@hotmail.com>
2003-03-25 06:07 encoding problem Alexey A. Britchko <beholder@roaddep.ru>
2003-03-25 08:16 ` Fouad Fezzi <Fouad.Fezzi@iup.univ-avignon.fr>
2011-09-12 11:38 Encoding Problem Mokhtary, Mandana <mandana.mokhtary@wspgroup.se>
2011-09-12 11:55 ` Re: Encoding Problem Florian Helmberger <fh@25th-floor.com>
2011-09-14 05:37 encoding problem Mokhtary, Mandana <mandana.mokhtary@wspgroup.se>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox