Search Postgresql Archives

Re: Weird encoding behavior

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Leonardo M. Ramé" wrote:
> Hi, I'm experiencing a weird behavior when storing latin characters to a  
> PostgreSQL 8.3.1.876 server. The database is Latin1 encoded, and it is  
> working since September 2008, it wasn't updated nor replaced since its  
> first installation.
>
> The weirdness of the problem is that sometimes the characters are stored  
> correctly, but sometimes doesn't (allways by the same program), the  
> field type is Varchar(30), and for example the text "NUÑEZ" is stored as  
> "NU?EZ".

You need to be sure that the client_encoding variable is set to whatever
the client is actually using.  Some client programs may be using UTF8,
and thus they should do "SET client_encoding TO utf8" on connection
start; others may be using Win-1252, Latin1, or other encodings.  If you
declare each correctly when the connection is established, the server
will do the right conversion for you automatically.  If you fail to do
that you will have a mess of characters, just like you do now.

BTW it is very advisable to update to 8.3.7.  It has a lot of bug fixes
since 8.3.1.

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux