Thread: localization, encoding problem
Hellou all
i have a problem to convert data from utf8 to ascii. My localization is slovakia and we use characters like
'á é š ť' and so on. But many times it is the same if u use 'á' or 'a'. Som I need to translate theese special characters. Somebody told me to use function to_ascii() but this function throws me an error : not supported encoding to ascii.
OS : debian
PostgreSQL : 8.1.3
configured with --enable-multibyte=UTF8
please help
thanx
I think first you need to be aware about the nature of the ASCII encoding within the postgresql server. ASCII encoding means that there is no encoding at all. So it would be the full responsibility of the client applications to store and read consistent encodings. Therefore it is clear that the server can not know what he should convert to within the function to_ascii() in this case. Second what fore do you need to convert? If you need the conversion for client readings you only have to set the desired encoding for the client by SET client_encoding = '[desired encoding]'; when you open the conncetion to the server. With this setting the server will convert the texts to the client encoding for you. If you need to change the 'á' to 'a' you most probably need to write a function (encoding) which does it for you. However this seems to be a extreemly wirred operation which most possibly should be solved within the client (by allowing this special charaters or converting them directly before inserting them into the database), then within the server. In the chapter 20.2. Character Set Support in the manual you can find more details about this issues. Best regards Ivo Rossacher Am Dienstag, 23. Mai 2006 13.37 schrieb j n: > Hellou all > > i have a problem to convert data from utf8 to ascii. My localization is > slovakia and we use characters like > 'á é š ť' and so on. But many times it is the same if u use 'á' or 'a'. Som > I need to translate theese special characters. Somebody told me to use > function to_ascii() but this function throws me an error : not supported > encoding to ascii. > > OS : debian > PostgreSQL : 8.1.3 > configured with --enable-multibyte=UTF8 > > please help > thanx