Re: Encoding Issue with UNICODE

From: fritz-bayer(at)web(dot)de (Fritz Bayer)
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Encoding Issue with UNICODE
Date: 2005-04-12 10:39:45
Message-ID: a9c0aa9e.0504120239.31b72c39@posting.google.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

daniel(at)manitou-mail(dot)org ("Daniel Verite") wrote in message news:<20050411035003(dot)3592776(at)localhost>...
> Fritz Bayer wrote:
>
> > I have a java program, which writes words containing german umlauts
> > like äöü into the database. As you probably know, those characters
> > belong to the ISO-8859-1 character encoding set.
> >
> > In my java webapplication those umlauts (äöü) get displayed correctly.
> > So they actually get stored correctly in the database.
> >
> > However, when I use postgresql's psql client I those characters get
> > displayed incorretly.
> >
> > For example the city name "münchen" gets displayed as "mÃ?nchen". Not
> > so in my webapplication. There the city name in the HTML code appears
> > corretly as "münchen".
> >
> > So why is psql not displaying the unicode characters correclty? Or
> > could it be that my xterm can not handle unicode characters?
>
> From your description it really looks like the latter. You can issue
> \encoding latin1
> inside psql
>

Thanks for you help. Now I undestand. It's true somehow my terminal
does not handle unicode characters.

After I entered "\encoding latin1" as you suggested everything works
fine. So the answer is that without that unicode characters get
displayed.

But in which encoding? I guess utf8 or utf16...

But why doesn that fail only for äüö? Shouldn't any other letter
encoded in utf16 also fail?

I mean unicode itself is 16 bit long. So "münchen" should expand to 14
characters. But only ü expands to two characters.

> or you can also set the PGCLIENTENCODING environment variable to latin1
> before launching psql on non-unicode aware terminals.
>
> > Can somebody help me out here? Should I create the databases as LATIN1
> > instead of UNICODE? And how can I transform my current databases into
> > LATIN1 ones? They should be compatible, because all characters I use
> > are only äöü, which are downward compatible.
>
> But then you'll have trouble with your java app if you do that. Java works with
> unicode strings, so it makes sense to have the db contents in unicode as well.

No thats ok. Java communicates with psql using unicode only. That's
why it also worked...

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Fritz Bayer 2005-04-12 10:41:31 Re: Encoding Issue with UNICODE
Previous Message Michael Ben-Nes 2005-04-12 09:24:26 Re: PostgreSQL 8.0.2 Now Available