Reputation: 95
Is there a way I can store ñ or Ñ characters in my postgres database, database is SQL_ASCII...
What I do is insert for "ñ" and in the database it saves as "ñ", output still "ñ" and that's good. But what I want is to insert "ñ" in the database as is.
My problem is some applications output the "ñ", like ateila or Crystal reports.
Any ideas guys?
Upvotes: 1
Views: 1165
Reputation: 324501
SQL_ASCII
is generally a bad idea. Consider converting your database to UTF-8. It's hard to do because your DB will be full of badly encoded data, but it will save you a lot of pain down the track.
SQL_ASCII
DBs can store non-ASCII chars just fine. Your applications just have to all expect the same encoding, and always consistently convert to/from that encoding. client_encoding
is ignored. In your application you must always make sure to convert text you get from external sources into that encoding, and convert data from the DB into the encoding expected by the external recipient. The main thing with SQL_ASCII
is that the DB won't check to make sure you're doing it right. It won't convert for you and it won't verify that the data matches client_encoding
. There's no metadata to tell clients what encoding you're using.
Change to UTF-8
.
Upvotes: 1
Reputation: 2069
Convert it to UTF-8 and give it a go, it should work. Check this question for more info:
Upvotes: 3