pg.ddx.io pgsql-jdbc@postgresql.org mailing list archive
help / color / mirror / Atom feedFrom: dmp <danap@ttc-cmc.net>
To: Laurent Schweizer <laurent.schweizer@peoplefone.com>
To: pgsql-jdbc@postgresql.org
Subject: Re: é converted in é
Date: Sat, 09 Feb 2013 09:55:17 -0700
Message-ID: <51167F75.5040102@ttc-cmc.net> (raw)
In-Reply-To: <004a01ce06ab$51c7dcb0$f5579610$@peoplefone.com>
References: <1360043227.14635.9.camel@localhost>
<CADK3HHJDvnHzcbEu2CMJ7g_riuMTi6D-=1mdvc+T-9DYEidvJA@mail.gmail.com>
<1360123883.14635.35.camel@localhost>
<CADK3HHLCdo=Ja1E+UZ-6veSyXTQq1zCsn9UsJoG+_6YoxzkU5w@mail.gmail.com>
<51154D4D.5060409@ttc-cmc.net>
<5115A7E4.7030505@ttc-cmc.net>
<5115A956.5020804@ttc-cmc.net>
<004a01ce06ab$51c7dcb0$f5579610$@peoplefone.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-jdbc>
Hello Laurent,
Use the Method provided to compare the two inserts methods, the one
I have demostrated and your process. Reply back with the modified
method, code, so that we may have a way of duplicating the error you
are describing.
I modified the Method this morning and used a update on the extended
ASCII chararcter and was still able to to a system.out and placement
in JLabel to observe the correct results.
If you drive to a garage and ask the mechanic to fix your lights on
your car because they do not work and he/she turns them on and they
work, how do you expect the mechanic to help?
Provide sample code demostrating your issue and perhaps help can be
more forth comming.
danap.
Laurent Schweizer wrote:
> Hello,
>
> I see that you directly convert special character , the problem is that
> with my application data are inserted with another process .
>
> When they insert the data in the DB all is ok. I have only an issue with
> JDBC to get them correctly.
>
> Laurent
>
>
>
>
> -----Message d'origine-----
> De : pgsql-jdbc-owner@postgresql.org
> [mailto:pgsql-jdbc-owner@postgresql.org] De la part de dmp
> Envoyé : samedi 9 février 2013 02:42
> À : laurent.schweizer@peoplefone.com; pgsql-jdbc@postgresql.org
> Objet : Re: [JDBC] é converted in é
>
> > Laurent Schweizer<laurent(dot)schweizer(at)peoplefone(dot)com> wrote:
> >
> > > I have an issue with special character like é.
> >
> > > 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 “é” 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 é is converted in é> > > > I have added to the connection string
> the option:
> > > ?useUnicode=true&characterEncoding=utf8
> > >
> > > And if I do a : "SHOW client_encoding;” 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 = con.createStatement();
> con.setAutoCommit(false);
>
> sqlStatementString = "DROP TABLE IF EXISTS jdbc_demo";
> sqlStatement.execute(sqlStatementString);
>
> sqlStatementString = "Create Table jdbc_demo (col VARCHAR(30))";
> sqlStatement.execute(sqlStatementString);
>
> pstmt = con.prepareStatement("INSERT INTO jdbc_demo VALUES (?),
> (?)");
> pstmt.setString(1, "\u0041"); // A
> pstmt.setString(2, "\u00E9"); // Acute Latin e
> pstmt.execute();
>
> sqlStatementString = "SELECT * FROM jdbc_demo";
> sqlStatement.execute(sqlStatementString);
>
> rs = sqlStatement.executeQuery(sqlStatementString);
>
> JPanel panel = new JPanel();
>
> while (rs.next())
> {
> String dataString = rs.getString("col");
> System.out.println("col:" + dataString);
> panel.add(new JLabel(dataString));
> }
> rs.close();
>
> JFrame frame = new JFrame();
> frame.getContentPane().add(panel);
> frame.setSize(200, 200);
> frame.setVisible(true);
>
> sqlStatementString = "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);
> }
> }
>
>
> --
> Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org) To make changes
> to your subscription:
> http://www.postgresql.org/mailpref/pgsql-jdbc
>
>
>
--
Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-jdbc
view thread (7+ messages) latest in thread
Message-ID: <51167F75.5040102@ttc-cmc.net>
Permalink: ../51167F75.5040102@ttc-cmc.net/
Also on: postgresql.org/message-id/51167F75.5040102@ttc-cmc.net
·
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: danap@ttc-cmc.net, laurent.schweizer@peoplefone.com
Subject: Re: é converted in é
In-Reply-To: <51167F75.5040102@ttc-cmc.net>
References: <1360043227.14635.9.camel@localhost> <CADK3HHJDvnHzcbEu2CMJ7g_riuMTi6D-=1mdvc+T-9DYEidvJA@mail.gmail.com> <1360123883.14635.35.camel@localhost> <CADK3HHLCdo=Ja1E+UZ-6veSyXTQq1zCsn9UsJoG+_6YoxzkU5w@mail.gmail.com> <51154D4D.5060409@ttc-cmc.net> <5115A7E4.7030505@ttc-cmc.net> <5115A956.5020804@ttc-cmc.net> <004a01ce06ab$51c7dcb0$f5579610$@peoplefone.com> <51167F75.5040102@ttc-cmc.net>
* 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