pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Markus Kickmaier <markus.kickmaier@apus.co.at>
To: pgsql-jdbc@postgresql.org
Subject: Encoding from CopyManager.copyIn()
Date: Wed, 22 Jul 2009 17:30:25 +0100 (GMT+01:00)
Message-ID: <9709844.92821248280225595.JavaMail.root@donald.apus.co.at> (raw)
In-Reply-To: <10290395.92801248279719869.JavaMail.root@donald.apus.co.at>

Hello,

I'm using the copyIn() function of the CopyManager. It works fine until I don't use an "umlaut" like ü. Then i get an PSQLException:

org.postgresql.util.PSQLException: ERROR: invalid byte sequence for encoding "UTF8": 0xfc

My code looks like follows:

ByteArrayOutputStream output = new ByteArrayOutputStream();
PrintWriter writer = new PrintWriter(output);
writer.println("abcüäö");
writer.flush();
ByteArrayInputStream input = new ByteArrayInputStream(output.toByteArray());
long result = ((PGConnection) con_).getCopyAPI().copyIn(statement, input);

After searching at google i found out that this is an encoding problem. The database doesn't know what charset I'm using.

Any suggestion how i can specify the encoding i want to use?

BR, Markus



view thread (7+ messages)  latest in thread

Message-ID: <9709844.92821248280225595.JavaMail.root@donald.apus.co.at>
Permalink:  ../9709844.92821248280225595.JavaMail.root@donald.apus.co.at/
Also on:    postgresql.org/message-id/9709844.92821248280225595.JavaMail.root@donald.apus.co.at

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: markus.kickmaier@apus.co.at
  Subject: Re: Encoding from CopyManager.copyIn()
  In-Reply-To: <9709844.92821248280225595.JavaMail.root@donald.apus.co.at>
  References: <10290395.92801248279719869.JavaMail.root@donald.apus.co.at> <9709844.92821248280225595.JavaMail.root@donald.apus.co.at>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox