pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Daniel Migowski <dmigowski@ikoffice.de>
To: Markus Kickmaier <markus.kickmaier@apus.co.at>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Encoding from CopyManager.copyIn()
Date: Fri, 24 Jul 2009 12:03:50 +0200
Message-ID: <4A698706.4040502@ikoffice.de> (raw)
In-Reply-To: <9709844.92821248280225595.JavaMail.root@donald.apus.co.at>
References: <9709844.92821248280225595.JavaMail.root@donald.apus.co.at>

The PrintWriter has another constructor where you can give "UTF8" as 
Encoding. Default is platform encoding (usually "Win1252" for me in 
Germany).

Best,
Daniel Migowski

Markus Kickmaier schrieb:
> 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: <4A698706.4040502@ikoffice.de>
Permalink:  ../4A698706.4040502@ikoffice.de/
Also on:    postgresql.org/message-id/4A698706.4040502@ikoffice.de

 · 

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: dmigowski@ikoffice.de, markus.kickmaier@apus.co.at
  Subject: Re: Encoding from CopyManager.copyIn()
  In-Reply-To: <4A698706.4040502@ikoffice.de>
  References: <9709844.92821248280225595.JavaMail.root@donald.apus.co.at> <4A698706.4040502@ikoffice.de>

* 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