Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1U3zNj-0000EA-1f for pgsql-jdbc@arkaria.postgresql.org; Sat, 09 Feb 2013 01:37:31 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1U3zNi-0000GU-Hr for pgsql-jdbc@arkaria.postgresql.org; Sat, 09 Feb 2013 01:37:30 +0000 Received: from magus.postgresql.org ([87.238.57.229]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1U3zMz-00007J-1T for pgsql-jdbc@postgresql.org; Sat, 09 Feb 2013 01:36:45 +0000 Received: from outbound.vnet-inc.com ([216.146.104.103]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1U3zMs-00023s-Bm for pgsql-jdbc@postgresql.org; Sat, 09 Feb 2013 01:36:43 +0000 Received: from [192.168.157.132] (unknown [76.75.27.41]) by outbound.vnet-inc.com (Postfix) with ESMTP id 15A3F5996; Fri, 8 Feb 2013 18:36:39 -0700 (MST) Message-ID: <5115A7E4.7030505@ttc-cmc.net> Date: Fri, 08 Feb 2013 18:35:32 -0700 From: dmp User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.13) Gecko/20100914 SeaMonkey/2.0.8 MIME-Version: 1.0 To: laurent.schweizer@peoplefone.com, pgsql-jdbc@postgresql.org Subject: =?windows-1252?Q?Contributors=0D=0A=09Mailing_Lists=0D=0A=09Us?= =?windows-1252?Q?er_lists=0D=0A=09Developer_lists=0D=0A=09Regional_?= =?windows-1252?Q?lists=0D=0A=09Associations=0D=0A=09User_groups=0D=0A=09?= =?windows-1252?Q?Project_lists=0D=0A=09pgadmin-hackers=0D=0A=09pgadmin?= =?windows-1252?Q?-support=0D=0A=09pgsql-jdbc=0D=0A=09pgsql-odbc=0D=0A=09?= =?windows-1252?Q?pgsql-pkg-debian=0D=0A=09pgsql-pkg-yum=0D=0A=09psycopg=0D?= =?windows-1252?Q?=0A=09Inactive_lists=0D=0A=09IRC=0D=0A=09Featured_U?= =?windows-1252?Q?sers=0D=0A=09International_Sites=0D=0A=09Propaganda=0D?= =?windows-1252?Q?=0A=09Resources=0D=0A=09Weekly_News=0D=0A=09Re=3A_=5B?= =?windows-1252?Q?JDBC=5D_=E9_converted_in_=C3=A9?= References: <1360043227.14635.9.camel@localhost> <1360123883.14635.35.camel@localhost> <51154D4D.5060409@ttc-cmc.net> In-Reply-To: <51154D4D.5060409@ttc-cmc.net> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: quoted-printable X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-jdbc Precedence: bulk Sender: pgsql-jdbc-owner@postgresql.org > Laurent Schweizer wrote: > > > I have an issue with special character like =E9. > > > I have as server postgres 9.2, I have created a new DB , encoding > > utf8 > > > > Client is a very simple test class that: > > 1) update a varchar value > > 2) read the same value and print them > > > > If I update the varchar with a special character like =93=E9=94 the > > value in the DB is correct ( I check them with another software ) > > but when I read them from my simple java class the value is not > > correct and the =E9 is converted in =C3=A9 > > > > I have added to the connection string the option: > > ?useUnicode=3Dtrue&characterEncoding=3Dutf8 > > > > And if I do a : "SHOW client_encoding;=94 I get UTF8 > > It is behaving as though the client is using a character encoding > other than UTF8 -- some sort of 8-bit encoding, probably. You must > set client_encoding to match. > > -Kevin Hello Laruent, I have tested the following method with the URL parameters you indicated with PostgreSQL 9.0.1 and the latest driver. Both on a linux and windows systems with the same result of the A and the Acute Latin e properly displaying in a system.out and the frame. I suppose it could be modified slightly to also check and update rather than an insert. danap. private void testInsertUTF(Connection con) { // Method Instances String sqlStatementString; Statement sqlStatement; PreparedStatement pstmt; ResultSet rs; try { sqlStatement =3D con.createStatement(); con.setAutoCommit(false); sqlStatementString =3D "DROP TABLE IF EXISTS jdbc_demo"; sqlStatement.execute(sqlStatementString); sqlStatementString =3D "Create Table jdbc_demo (col VARCHAR(30))"; sqlStatement.execute(sqlStatementString); pstmt =3D con.prepareStatement("INSERT INTO jdbc_demo VALUES (?),= (?)"); pstmt.setString(1, "\u0041"); // A pstmt.setString(2, "\u00E9"); // Acute Latin e pstmt.execute(); sqlStatementString =3D "SELECT * FROM jdbc_demo"; sqlStatement.execute(sqlStatementString); rs =3D sqlStatement.executeQuery(sqlStatementString); JPanel panel =3D new JPanel(); while (rs.next()) { String dataString =3D rs.getString("col"); System.out.println("col:" + dataString); panel.add(new JLabel(dataString)); } rs.close(); JFrame frame =3D new JFrame(); frame.getContentPane().add(panel); frame.setSize(200, 200); frame.setVisible(true); sqlStatementString =3D "DROP TABLE IF EXISTS jdbc_demo"; sqlStatement.execute(sqlStatementString); sqlStatement.close(); pstmt.close(); con.setAutoCommit(true); } catch (SQLException sqle) { System.out.println("SQL Exeception" + sqle); } } --=20 Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-jdbc