Pregunta

I am having a problem with the charset and the colleration of PostgreSQL. When I setup a new database I can choose between C, Greek_Greece.1253 and POSIX for Collation and Character Type. I choose UTF8 for encoding, Greek_Greece.1253 for charset/collation and I input some greek characters using ADO connection (Devart provider).

When I make a select using ADO I don't get the data I was expecting to find(Greek words) but insteed I get some weird looking characters (And i think that I get more than expected).

I was tring to change the collation and character type to something close to UTF-8 such as Greek_Greece.UTF-8 but it's not available and allowed by the pgAdmin.

My setup is in windows.Do you have any idea how to make UTF-8 available for sellecting in charset type or how to retrieve the data in a better way?

¿Fue útil?

Solución

It looks like your OS doesn't have support for Greek collation in UTF-8.

You can see all the collations available to PostgreSQL with the following query:

select * from pg_collation;

Greek is el_GR.utf8. If listed, you would create a database using the query:

CREATE DATABASE greek WITH ENCODING 'UTF-8' LC_COLLATE='el_GR.utf8' LC_CTYPE='el_GR.utf8' TEMPLATE=template0;

If not listed, then you would need to add language support at the OS level.

I'm not very familiar with Windows, but from memory there is a way to add languages in the control panel (not sure if this adds UTF-8 support though).

With Debian Linux it's very easy:

$ dpkg-reconfigure locales

In any case, I would strongly advise you not to use the windows-1253 encoding for anything in your database. From experience, non-utf8 data will cause much pain down the road...

Otros consejos

The dotConnect for PostgreSQL connection string includes the Unicode parameter. Try setting it to True.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top