Re: Encoding Problem

From: Kris Jurka <books(at)ejurka(dot)com>
To: Jerome Colombie <jcolombie(at)gmx(dot)ch>
Cc: Oliver Jowett <oliver(at)opencloud(dot)com>, pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Encoding Problem
Date: 2005-01-13 23:51:07
Message-ID: Pine.BSO.4.56.0501131846001.32114@leary.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

On Fri, 14 Jan 2005, Jerome Colombie wrote:

> I made a low-level program which prints to the console. It seems that
> the jdbc driver is correct, although the Strings need some
> postprocessing in Java. I want to create html output, so I don't know if
> I have to change my windows settings, java settings (Locale) or just
> need to reformat the strings in java code.
> My test program looks like this:
>

> String t1 = new String("aäöü".getBytes(), "ISO-8859-1");
> String t1 = new String("aäöü".getBytes(), "UTF-8");

At least one of these is clearly bogus. I don't know what your default
encoding is, but getBytes() will return data in that encoding, from there
you are telling Java to interpret that one piece of data in two
different ways, one of these must be wrong.

> How can I get the correct output in html with java code? I know that
> technically it hasn't got to do with jdbc but I still hope someone can
> give me a solution so I don't need to change the java code. I hope I can
> solve this problem by changing either the database configuration or the
> java or windows locale.
>

To produce correctly encoded html, you need to ensure that your java
environment's default encoding matches up with the encoding you have set
for the page.

Kris Jurka

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Oliver Jowett 2005-01-14 00:04:47 Re: Encoding Problem
Previous Message Jerome Colombie 2005-01-13 23:34:53 Re: Encoding Problem