Thread: Collate problem

Collate problem

From
talenat
Date:
Hi,
I have a mandrake 10.1 server running Postgres 8.1beta3 with hr_HR
locale. Client is a XP with WIN1250 code page.
When I use ORDER BY in query collation is out of order.
I have tried with client encoding WIN1250 and LATIN2 but with no luck.
If I use XP as a server with postgres 8.1beta3 then everything is as
expected.
The database is filled with with data from script made on XP with
WIN1250 codepage.
It looks like conversion from Latin2 to Win1250 is not correct and I
don't know what to do.
Any hint is welcome.
BR

Re: Collate problem

From
talenat
Date:
talenat wrote:
> Hi,
> I have a mandrake 10.1 server running Postgres 8.1beta3 with hr_HR
> locale. Client is a XP with WIN1250 code page.
> When I use ORDER BY in query collation is out of order.
> I have tried with client encoding WIN1250 and LATIN2 but with no luck.
> If I use XP as a server with postgres 8.1beta3 then everything is as
> expected.
> The database is filled with with data from script made on XP with
> WIN1250 codepage.
> It looks like conversion from Latin2 to Win1250 is not correct and I
> don't know what to do.
> Any hint is welcome.
> BR

Here is an update to above.
If I execute SELECT * FROM atable ORDER BY afield then collate is wrong.
If I execute SELECT * FROM atable WHERE afield LIKE 'Š%' ORDER BY afield
then collate is OK for returned subset.
afield is a index field.
It seems to me that there is a bug here but I need to be sure if I am
not missing something.



Re: Collate problem

From
talenat
Date:
talenat wrote:
> talenat wrote:
>
>> Hi,
>> I have a mandrake 10.1 server running Postgres 8.1beta3 with hr_HR
>> locale. Client is a XP with WIN1250 code page.
>> When I use ORDER BY in query collation is out of order.
>> I have tried with client encoding WIN1250 and LATIN2 but with no luck.
>> If I use XP as a server with postgres 8.1beta3 then everything is as
>> expected.
>> The database is filled with with data from script made on XP with
>> WIN1250 codepage.
>> It looks like conversion from Latin2 to Win1250 is not correct and I
>> don't know what to do.
>> Any hint is welcome.
>> BR
>
>
> Here is an update to above.
> If I execute SELECT * FROM atable ORDER BY afield then collate is wrong.
> If I execute SELECT * FROM atable WHERE afield LIKE 'Š%' ORDER BY afield
> then collate is OK for returned subset.
> afield is a index field.
> It seems to me that there is a bug here but I need to be sure if I am
> not missing something.
>
>
Hi,
Here is a only solution that I could find so I hope that it will help
others.
It is definitely something wrong with automatic translation between
Linux and Win.
For Croatian character set on Linux default encoding is Latin2 and on
Win it is Win1250. As I understand that translation should be automatic
inside Postgresql server but the collation is wrong.
The solution is to use HR_UTF8 ( unicode ) on Linux and then DBInit
creates templates as unicode.
When you create your database use UNICODE as encoding.
After this you could use WIN1250 as client side encoding ( if the client
is on Win machine since that is a code page for Croatia ) and everything
is as expected.
I don't know if there are any performance penalty but it works.

BR