Обсуждение: encoding problem when creating a database

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

encoding problem when creating a database

От
"A B"
Дата:
I get this message when it fails to create a new database

encoding UTF8 does not match server's locale sv_SE.iso88591

when trying to create a database with the createdb command and the parameter
" -E UTF8"

I'm not sure what to change here.
Any good ideas?

Re: encoding problem when creating a database

От
"A. Kretschmer"
Дата:
am  Wed, dem 02.07.2008, um 15:52:23 +0200 mailte A B folgendes:
> I get this message when it fails to create a new database
>
> encoding UTF8 does not match server's locale sv_SE.iso88591
>
> when trying to create a database with the createdb command and the parameter
> " -E UTF8"

You have created the db-cluster with sv_SE.iso88591. Because of this,
you can't now create a db with an incompatible locale.


>
> I'm not sure what to change here.
> Any good ideas?

Make a full database dump, drop the db-cluster, recreate it with locale
UTF8 and restore your dump.


Regards, Andreas
--
Andreas Kretschmer
Kontakt:  Heynitz: 035242/47150,   D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID:   0x3FFF606C, privat 0x7F4584DA   http://wwwkeys.de.pgp.net

Re: encoding problem when creating a database

От
"A B"
Дата:
> You have created the db-cluster with sv_SE.iso88591. Because of this,
> you can't now create a db with an incompatible locale.

Oh, so i need to run something like
initdb -E UTF8  --pgdata XXX
to create a new db-cluster?
What about the --locale option? Something I need to do with that?

What should let XXX be? I have all the stuff in /var/lib/pgsql/ and
I'd like to put it all there.

Do I have to do something after createing a new db-cluster or can I
start createing databases as ususal?

Re: encoding problem when creating a database

От
"A B"
Дата:
alright, now I have created a new db-cluster with initdb -E UTF8
--locale=C and the encoding problem still remains when trying to
access with PHP.

Error ERROR: invalid byte sequence for encoding "UTF8": 0xe56e69 HINT: This
error can also happen if the byte sequence does not match the encoding
expected by the server, which is controlled by "client_encoding".

I'm really lost on what to do with this.
Any ideas anyone?

2008/7/2 A B <gentosaker@gmail.com>:
>> You have created the db-cluster with sv_SE.iso88591. Because of this,
>> you can't now create a db with an incompatible locale.
>
> Oh, so i need to run something like
> initdb -E UTF8  --pgdata XXX
> to create a new db-cluster?
> What about the --locale option? Something I need to do with that?
>
> What should let XXX be? I have all the stuff in /var/lib/pgsql/ and
> I'd like to put it all there.
>
> Do I have to do something after createing a new db-cluster or can I
> start createing databases as ususal?
>

Re: encoding problem when creating a database

От
Tom Lane
Дата:
"A B" <gentosaker@gmail.com> writes:
> alright, now I have created a new db-cluster with initdb -E UTF8
> --locale=C and the encoding problem still remains when trying to
> access with PHP.

> Error ERROR: invalid byte sequence for encoding "UTF8": 0xe56e69 HINT: This
> error can also happen if the byte sequence does not match the encoding
> expected by the server, which is controlled by "client_encoding".

What encoding is your PHP script actually working in?  It's apparently
not UTF8.

            regards, tom lane

Re: encoding problem when creating a database

От
Stephan Szabo
Дата:
On Wed, 2 Jul 2008, A B wrote:

> alright, now I have created a new db-cluster with initdb -E UTF8
> --locale=C and the encoding problem still remains when trying to
> access with PHP.
>
> Error ERROR: invalid byte sequence for encoding "UTF8": 0xe56e69 HINT: This
> error can also happen if the byte sequence does not match the encoding
> expected by the server, which is controlled by "client_encoding".

That sequence isn't valid UTF8. What encoding is the PHP script trying to
send data in? If it's something other than UTF8 (for example ISO8859-1),
you need to set client_encoding to the correct encoding.