On 09/12/13 15:07, Roberto Scattini wrote: > hi bosco, in fact i believe that i have that problem... but i cant > undestand why and how to fix it. > > the database has SQL_ASCII encoding, and my client... i am not sure, when i > connect directly with psql from localhost i must set client encoding to > SQL_ASCII or i receive an "invalid utf8 sequence" error... > > but the problem is there, from psql, from pgadmin and from php/apache (my > webservers) Well, the bytes that get encoded (in UTF8) for lowercase 'enye' is x'c3b1' and for the uppercase version is x'c391' thus when they are compared as straight bytes they will never be considered equal wrt case-insensitivity. The "invalid utf8 sequence" error is due to, as it says, an invalid utf8 sequence in your text strings. This is due to the lack of any enforcement provided by the SQL_ASCII encoding that was probably in effect when the data was initially inserted. To get to a point where you can use your data in its proper encoding you will need to identify which strings are invalid and then dump the DB and restore it into an appropriately initialized DB. You could use the restore process to help you find the bad strings but that is tedious as all hell. Better to scan you strings somehow and locate the ones that are invalid and fix them prior to the dump. HTH, Bosco. -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general