Thread: Question about character encoding
Hi! This may be completely stupid, but I just can't figure... I installed the latest cygwin snapshot along with PostgreSQL 7.2; I access the DB using the latest PGAdmin II 1.2.0. Almost everything seems to be working fine - with one major glitch: I just cannot insert nor select strings containing german umlaute or any other special characters into my database. I selected Unicode as encoding (was that correct?), but when I do INSERT INTO test VALUES (1,'this is an example string containing ä, ö, ü, Ä, Ö, Ü, ß'); I just get "Invalid UNICODE character sequence found". So far I just cannot store nor retrieve ordinary german text... What do I need to do in order to get this working? So far I haven't found any postings about people having elementary problems like this, so I think it's just something obvious that I nevertheless fail to see - could you please enlighten me? Is the binary that came with cygwin compiled with locale- and multibyte-support at all? Thanks, Markus
> I installed the latest cygwin snapshot along with PostgreSQL 7.2; I > access the DB using the latest PGAdmin II 1.2.0. Almost everything seems > to be working fine - with one major glitch: I just cannot insert nor > select strings containing german umlaute or any other special characters > into my database. > I selected Unicode as encoding (was that correct?), but when I do pAlthough it may sound strange, gAdmin2 is not yet compatible with Unicode for various reasons explained at pgadmin-hackers@postgresql.org. Unicode is mainly used for non european languages. SQL_ASCII encoding can handle most european languages, including German. So, just create a database with SQL_ASCII encoding. And this will solve your problem. (If you are really interested by Unicode, use pgAdmin2 to create and maintain the schema of your database. But don't use it ***yet*** to view or insert data. Use Apache/Php or Java instead.) Das lebte die deutsche-französische Freundschaft, Jean-Michel pOURE Dave : I am going to set defaut database encoding to SQL_ASCII. This will avoid a confusion.
> -----Original Message----- > From: Jean-Michel POURE [mailto:jm.poure@freesurf.fr] > Sent: 21 February 2002 13:27 > To: Markus Wollny; pgsql-cygwin@postgresql.org > Cc: pgadmin-hackers@postgresql.org > Subject: Re: [CYGWIN] Question about character encoding > > > > > Dave : I am going to set defaut database encoding to > SQL_ASCII. This will > avoid a confusion. > I thought it already was! cheers, Dave.
Jean-Michel POURE [mailto:jm.poure@freesurf.fr] wrote: > SQL_ASCII encoding can handle most european languages, including German. So, > just create a database with SQL_ASCII encoding. And this will solve your > problem. Thanks - that did it. I just didn't think ASCII was the correct encoding as one usually relates ascii to one-byte standard characters. One more question though: It's actually possible to create databases with names in capital letters using PGAdmin II. As it's impossible to drop databases in PGAdmin, I tried to do it via pgsql. It seems however, that psql just automatically converts anything to lower case, therefore giving me "ERROR: DROP DATABASE: database "test" does not exist" when I try "drop database TEST;". When doing "select * from pg_database;" on template1 "TEST" is sitting there, glaring, without me being able to kick it. Therefore I have the impression that it's absolutely not advisable to create any object with capitals in it's name via PG Admin II. Is that correct? If so, why not automatically convert any names in the connect string to lower case, in order to prevent this from happening? Would there be still some way of dropping such a database even though it's not possible with neither PG Admin II nor psql? Cheers & thanks for your support, Markus
> -----Original Message----- > From: Markus Wollny [mailto:Markus.Wollny@computec.de] > Sent: 21 February 2002 14:30 > To: jm.poure@freesurf.fr; pgsql-cygwin@postgresql.org > Subject: Re: [CYGWIN] Question about character encoding > > > Jean-Michel POURE [mailto:jm.poure@freesurf.fr] wrote: > > > SQL_ASCII encoding can handle most european languages, including > German. So, > > just create a database with SQL_ASCII encoding. And this will solve > your > > problem. > > > Thanks - that did it. I just didn't think ASCII was the > correct encoding > as one usually relates ascii to one-byte standard characters. > > One more question though: It's actually possible to create databases > with names in capital letters using PGAdmin II. As it's impossible to > drop databases in PGAdmin, I tried to do it via pgsql. It > seems however, > that psql just automatically converts anything to lower case, > therefore > giving me "ERROR: DROP DATABASE: database "test" does not > exist" when I > try "drop database TEST;". > When doing "select * from pg_database;" on template1 "TEST" is sitting > there, glaring, without me being able to kick it. Therefore I have the > impression that it's absolutely not advisable to create any > object with > capitals in it's name via PG Admin II. Is that correct? If so, why not > automatically convert any names in the connect string to > lower case, in > order to prevent this from happening? Would there be still some way of > dropping such a database even though it's not possible with neither PG > Admin II nor psql? Try DROP DATABASE "TEST"; Mixed case identifiers must be quoted in PostgreSQL. In pgAdmin II, *only* databases cannot be dropped so this isn't a major issue for most things. Personally I keep everything lowercase, but that's just me :-) Regards, Dave.