Обсуждение: Pb with the French accentuated characters

Поиск
Список
Период
Сортировка

Pb with the French accentuated characters

От
frederic massot
Дата:
Hello,

Since the update of a PC of test (Debian GNU/Linux Woody, Apache
1.3.23-1, Php4 4.1.2, Postgresql 7.2.1), the Web sites functioning on
this PC produce errors during the insertion of French accentuated
characters ("é", "è", "à", etc...) in the databases.

An error message with PHP :

PostgreSQL query failed:  ERROR:  Invalid UNICODE character sequence
found (0xe97373)

Error messages with psql :

juliana=> insert into essai values ('était');
ERROR:  Invalid UNICODE character sequence found (0xe97461)
juliana=> insert into essai values ('ètait');
ERROR:  Invalid UNICODE character sequence found (0xe87461)
juliana=> insert into essai values ('àtait');
ERROR:  Invalid UNICODE character sequence found (0xe07461)


With version 7.1.3 of Postgresql not did not have any errors.

All the databases are encoding in UNICODE.

Postgresql is compiled with the option "--enable-unicode-conversion".

I know that version 7.2.1 of Postgresql checks the data before inserting
them. But I do not understand why conversion does not function.

Do you have an idea ?

Thank you.
--
==============================================
|              FREDERIC MASSOT               |
|     http://www.juliana-multimedia.com      |
|   mailto:frederic@juliana-multimedia.com   |
===========================Debian=GNU/Linux===

Re: Pb with the French accentuated characters

От
Jean-Michel POURE
Дата:
Le Mardi 30 Avril 2002 14:51, frederic massot a écrit :
> Since the update of a PC of test (Debian GNU/Linux Woody, Apache
> 1.3.23-1, Php4 4.1.2, Postgresql 7.2.1), the Web sites functioning on
> this PC produce errors during the insertion of French accentuated
> characters ("é", "è", "à", etc...) in the databases.
> An error message with PHP :
> PostgreSQL query failed:  ERROR:  Invalid UNICODE character sequence
> found (0xe97373)

So I presume your database is Unicode.

> Error messages with psql :
> juliana=> insert into essai values ('était');
> ERROR:  Invalid UNICODE character sequence found (0xe97461)
> juliana=> insert into essai values ('ètait');
> ERROR:  Invalid UNICODE character sequence found (0xe87461)
> juliana=> insert into essai values ('àtait');
> ERROR:  Invalid UNICODE character sequence found (0xe07461)

Enter:
SET CLIENT_ENCODING = 'Latin9'

This will recode backend<->client stream from Unicode to Latin + Euro
encoding. If you don't need Euro support, you could also recode to Latin1.

Otherwise, when importing text from a flat file (Latin) into a unicode
database (UTF8), recode the file using :

recode ..u8 filename.sql

Cheers,
Jean-Michel POURE


Re: Pb with the French accentuated characters

От
frederic massot
Дата:
Jean-Michel POURE wrote:
>
>
> Enter:
> SET CLIENT_ENCODING = 'Latin9'
>
> This will recode backend<->client stream from Unicode to Latin + Euro
> encoding. If you don't need Euro support, you could also recode to Latin1.
>

Ok, but for a site allowing the updates of the data for a French users,
or for a Brazilian, with the same interface ?

Sometimes our customers are not French.
Certain parts of the Web site will be updated with French characters,
others with non French characters.
--
==============================================
|              FREDERIC MASSOT               |
|     http://www.juliana-multimedia.com      |
|   mailto:frederic@juliana-multimedia.com   |
===========================Debian=GNU/Linux===

Re: Pb with the French accentuated characters

От
Jean-Michel POURE
Дата:
Le Mardi 30 Avril 2002 15:56, frederic massot a écrit :
> Ok, but for a site allowing the updates of the data for a French users,
> or for a Brazilian, with the same interface ?
> Sometimes our customers are not French.
> Certain parts of the Web site will be updated with French characters,
> others with non French characters.

Latin9 means ISO_8859-15 = all Western languages.
This should work for Brazilian.

Otherwise, if you need Arabic + Japanese + French + etc..,
use a complete Unicode chain:

1) Your web pages (.php) should be saved in UTF-8 format.

2) Your web pages (.php) should send UTF-8 headers to the internet browser (to
tell the browser to switch to UTF-8).

3) PHP should be compiled with mb options enabled.
See http://uk.php.net/manual/en/ref.mbstring.php.
Otherwize you wron't be able to calculate string lenght, etc...
mbstring.func_overload should be set to 4 in php.ini to automatically
overload PHP functions with their ITF-8 equivalent.

Have fun,
Jean-Michel POURE

Re: Pb with the French accentuated characters

От
frederic massot
Дата:
Jean-Michel POURE wrote:
>
>
> So I presume your database is Unicode.
>
> > Error messages with psql :
> > juliana=> insert into essai values ('était');
> > ERROR:  Invalid UNICODE character sequence found (0xe97461)
> > juliana=> insert into essai values ('ètait');
> > ERROR:  Invalid UNICODE character sequence found (0xe87461)
> > juliana=> insert into essai values ('àtait');
> > ERROR:  Invalid UNICODE character sequence found (0xe07461)
>
> Enter:
> SET CLIENT_ENCODING = 'Latin9'
>
> This will recode backend<->client stream from Unicode to Latin + Euro
> encoding. If you don't need Euro support, you could also recode to Latin1.

I have just tested your solutions:

juliana=> select * from essai;
 un
----
(0 rows)

juliana=> insert into essai values ('était');
ERROR:  Invalid UNICODE character sequence found (0xe97461)
juliana=> SET CLIENT_ENCODING = 'latin9';
SET VARIABLE
juliana=> insert into essai values ('était');
INSERT 225971 1
juliana=> select * from essai;
  un
------
 tait
(1 row)

juliana=> SET CLIENT_ENCODING = 'latin1';
SET VARIABLE
juliana=> insert into essai values ('était');
INSERT 225972 1
juliana=> select * from essai;
  un
------
 tait
 tait
(2 rows)


There is always a problem with the accents, Arghh !!!

Regards.
--
==============================================
|              FREDERIC MASSOT               |
|     http://www.juliana-multimedia.com      |
|   mailto:frederic@juliana-multimedia.com   |
===========================Debian=GNU/Linux===

Incompatibility Postgres 7.1 - Postgres 7.3

От
"Areski Belaid"
Дата:
Someone can help me ....

I have a compatibility problem between Postgres 7.1 - Postgres 7.3...
Guess !!! It's  --- timestamptz ---

When I create a field with timestamp type... the new postgresql replace that
by
timestamptz.... I use phpPgAdmin, I don't know where is from  the problem...

Simple example, If I execute that :
    CREATE TABLE "statistic" (
           "Id" int4 NOT NULL,
           "DATE" timestamp);

I shall have that on the database:
      CREATE TABLE "statistic" (
           "Id" int4 NOT NULL,
           "DATE" timestamptz);

Grrrrrr, =)

Helpsssssss, Areski



DateStyle question

От
"Sherwin Harris"
Дата:
My question is probably simpler than most of you deal with but:
How do I change the datestyle of my database so that it is in the US style
(or any other style for that matter)?
I want it to start in the new style, not just change it with a SET command.
Any comments or reasons why I should not do this are also welcome.
Sherwin Harris


Re: Incompatibility Postgres 7.1 - Postgres 7.3

От
Dan Wilson
Дата:
Postgres has two different timestamp types now.  There is "timestamp with
timezone" and "timestamp without timezone".  Internally the "with timezone" is
stored as timestamptz. And by default, a timestamp will have a timezone. You
can think of timestamptz as the same as timestamp.

So there is really not a problem here unless you wanted a "timestamp without
timezone".  If this is the case, currently phpPgAdmin doesn't provide for the
creation of timestamp without timezone through the table create
functionality.  You will have to do it manually through the "Run SQL" box in
the DB Details page.

-Dan

Quoting Areski Belaid <areski5@hotmail.com>:

> Someone can help me ....
>
> I have a compatibility problem between Postgres 7.1 - Postgres 7.3...
> Guess !!! It's  --- timestamptz ---
>
> When I create a field with timestamp type... the new postgresql replace that
> by
> timestamptz.... I use phpPgAdmin, I don't know where is from  the problem...
>
> Simple example, If I execute that :
>     CREATE TABLE "statistic" (
>            "Id" int4 NOT NULL,
>            "DATE" timestamp);
>
> I shall have that on the database:
>       CREATE TABLE "statistic" (
>            "Id" int4 NOT NULL,
>            "DATE" timestamptz);
>
> Grrrrrr, =)
>
> Helpsssssss, Areski
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo@postgresql.org so that your
> message can get through to the mailing list cleanly




Incompatibility Postgres 7.1 - Postgres 7.2.1

От
"Areski Belaid"
Дата:
----- Original Message -----
From: "Dan Wilson" <dan@acucore.com>
To: "Areski Belaid" <areski5@hotmail.com>
Cc: <pgsql-php@postgresql.org>
Sent: Saturday, June 01, 2002 4:33 PM
Subject: Re: [PHP] Incompatibility Postgres 7.1 - Postgres 7.3


> Postgres has two different timestamp types now.  There is "timestamp with
> timezone" and "timestamp without timezone".  Internally the "with
timezone" is
> stored as timestamptz. And by default, a timestamp will have a timezone.
You
> can think of timestamptz as the same as timestamp.
>
> So there is really not a problem here unless you wanted a "timestamp
without
> timezone".  If this is the case, currently phpPgAdmin doesn't provide for
the
> creation of timestamp without timezone through the table create
> functionality.  You will have to do it manually through the "Run SQL" box
in
> the DB Details page.
>
> -Dan
>
> Quoting Areski Belaid <areski5@hotmail.com>:
>
> > Someone can help me ....
> >
> > I have a compatibility problem between Postgres 7.1 - Postgres 7.3...
> > Guess !!! It's  --- timestamptz ---
> >
> > When I create a field with timestamp type... the new postgresql replace
that
> > by
> > timestamptz.... I use phpPgAdmin, I don't know where is from  the
problem...
> >
> > Simple example, If I execute that :
> >     CREATE TABLE "statistic" (
> >            "Id" int4 NOT NULL,
> >            "DATE" timestamp);
> >
> > I shall have that on the database:
> >       CREATE TABLE "statistic" (
> >            "Id" int4 NOT NULL,
> >            "DATE" timestamptz);
> >
> > Grrrrrr, =)
> >
> > Helpsssssss, Areski
> >


It's working if I introduce the sql command directly in the shell...

CREATE TABLE "statistic" (
          "Id" int4 NOT NULL,
          "DATE" timestamp without time zone);

One thing good, but I just realize That my  problem isn't coming of the time
zone
BUT of the precision...

EXAMPLE:
If I want know the number of day between two date ($lastdate -
$firstdate)...

Value of firstdate = 2002-05-31 12:27:05.121201
Value of lastdate = 2002-06-04 12:29:25.147232

$oneday = 60*60*24*1;
$number_day_between_two_date = intval(( strtotime($lastdate) -
strtotime($firstdate) )/$oneday);

I did that and It' was working without problem before the upgrate of
postgres (Postgres 7.1 - Postgres 7.2.1)

Someone have a idea... What I can do to know the number of day between two
date...


Areski'ch


Duplicate Database

От
"Areski Belaid"
Дата:
Hello to everyone,

I have a application using Postgres DB and I going to create a new version
on the same server... I would like duplicate my database with all structure
and data
like that, I can update this new version and  keep the last one active
during the release version.

BUT, doesm't work =(

First I create the backup, like that :
pg_dump > db.out


After I try to duplicate this one :

So I create a other user "new-user" and I create a new db "new-db" (new-user
is the owner new-db)
next step :
change 1 ligne on db.out file :
Replace :  "\connect - dbname"   by  "\connect - new-db"

To finish, I try that :
    psql  new-db< db.out



Of course, it doesn't work, otherwise I won't disturb you =)

Error message:
1: You are now connected as new user new-db
2: ERROR:  Relation 'table1' already exists
3: ERROR:  Relation 'table1' already exists
4: ...



I tried a lot of think without success, Some helpsssssssss pleaseee.



Thanks to the community, Areski





Re: Duplicate Database

От
"Areski Belaid"
Дата:
I just found and it's working good :

createdb --template=db new-db


=), haaaaaaaaaaa Que bien





On Friday 02 August 2002 12:46 pm, Areski Belaid wrote:
> Hello to everyone,
>
> I have a application using Postgres DB and I going to create a new version
> on the same server... I would like duplicate my database with all
structure
> and data
> like that, I can update this new version and  keep the last one active
> during the release version.
>
> BUT, doesm't work =(
>
> First I create the backup, like that :
> pg_dump > db.out
>
>
> After I try to duplicate this one :
>
> So I create a other user "new-user" and I create a new db "new-db"
> (new-user is the owner new-db)
> next step :
> change 1 ligne on db.out file :
> Replace :  "\connect - dbname"   by  "\connect - new-db"
>
> To finish, I try that :
>     psql  new-db< db.out

try psql -f db.out newdb
run the whole thing as user postgres, that should work.



>
>
>
> Of course, it doesn't work, otherwise I won't disturb you =)
>
> Error message:
> 1: You are now connected as new user new-db
> 2: ERROR:  Relation 'table1' already exists
> 3: ERROR:  Relation 'table1' already exists
> 4: ...
>
>
>
> I tried a lot of think without success, Some helpsssssssss pleaseee.
>
>
>
> Thanks to the community, Areski

Re: Duplicate Database

От
Chris Ruprecht
Дата:
On Friday 02 August 2002 12:46 pm, Areski Belaid wrote:
> Hello to everyone,
>
> I have a application using Postgres DB and I going to create a new version
> on the same server... I would like duplicate my database with all structure
> and data
> like that, I can update this new version and  keep the last one active
> during the release version.
>
> BUT, doesm't work =(
>
> First I create the backup, like that :
> pg_dump > db.out
>
>
> After I try to duplicate this one :
>
> So I create a other user "new-user" and I create a new db "new-db"
> (new-user is the owner new-db)
> next step :
> change 1 ligne on db.out file :
> Replace :  "\connect - dbname"   by  "\connect - new-db"
>
> To finish, I try that :
>     psql  new-db< db.out

try psql -f db.out newdb
run the whole thing as user postgres, that should work.



>
>
>
> Of course, it doesn't work, otherwise I won't disturb you =)
>
> Error message:
> 1: You are now connected as new user new-db
> 2: ERROR:  Relation 'table1' already exists
> 3: ERROR:  Relation 'table1' already exists
> 4: ...
>
>
>
> I tried a lot of think without success, Some helpsssssssss pleaseee.
>
>
>
> Thanks to the community, Areski
>
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html

The Last Optimization

От
"Areski Belaid"
Дата:
I have a huge table with 14 field and few million of data...
My application Php/Pg start to be impossible to use.

    Redhat 7.3
    Dual PIII 900Mhz System
    2GB RAM

I did already a some optimization optimization :

    max_connections = 64
    shared_buffers = 32000
    sort_mem = 64336
    fsync = false
                        ---
    echo 128000000 > /proc/sys/kernel/shmmax

    also Vaccum,analyze and Index

                        ---

    This optimization was enough at the beginning but NOT now with some
million of instance.

    So WHAT I CAN DO ??? USE ORACLE ???

    I Think maybe to split my mean table to different table Mean_a Mean_b
... Mean_z ???
    IF it's the way someone where I can find doc or help about howto split
table ???

    I M lost !!! ;)



Areski

Re: The Last Optimization

От
Christopher Kings-Lynne
Дата:
You'll have to post your complete schema and the actual queries you are
runing that are so slow.  Postgres can easily handle such large tables, so
there's probably more improvements you can make to the speed.

Chris

On Fri, 6 Sep 2002, Areski Belaid wrote:

> I have a huge table with 14 field and few million of data...
> My application Php/Pg start to be impossible to use.
>
>     Redhat 7.3
>     Dual PIII 900Mhz System
>     2GB RAM
>
> I did already a some optimization optimization :
>
>     max_connections = 64
>     shared_buffers = 32000
>     sort_mem = 64336
>     fsync = false
>                         ---
>     echo 128000000 > /proc/sys/kernel/shmmax
>
>     also Vaccum,analyze and Index
>
>                         ---
>
>     This optimization was enough at the beginning but NOT now with some
> million of instance.
>
>     So WHAT I CAN DO ??? USE ORACLE ???
>
>     I Think maybe to split my mean table to different table Mean_a Mean_b
> ... Mean_z ???
>     IF it's the way someone where I can find doc or help about howto split
> table ???
>
>     I M lost !!! ;)
>
>
>
> Areski
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo@postgresql.org so that your
> message can get through to the mailing list cleanly
>