Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1Tiqhz-0005UX-HW for pgsql-sql@arkaria.postgresql.org; Wed, 12 Dec 2012 18:07:03 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1Tiqhy-0003xe-5Y for pgsql-sql@arkaria.postgresql.org; Wed, 12 Dec 2012 18:07:02 +0000 Received: from magus.postgresql.org ([87.238.57.229]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1Tiqhx-0003xZ-Hs for pgsql-sql@postgresql.org; Wed, 12 Dec 2012 18:07:01 +0000 Received: from oldperseverance.encs.concordia.ca ([132.205.96.94]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1Tiqhv-0002OE-Ji for pgsql-sql@postgresql.org; Wed, 12 Dec 2012 18:07:01 +0000 Received: from cacao.encs.concordia.ca (emilu@cacao.encs.concordia.ca [132.205.47.225]) by oldperseverance.encs.concordia.ca (envelope-from emilu@encs.concordia.ca) (8.13.7/8.13.7) with ESMTP id qBCI6vo9025171; Wed, 12 Dec 2012 13:06:57 -0500 Message-ID: <50C8C7C1.6050705@encs.concordia.ca> Date: Wed, 12 Dec 2012 13:06:57 -0500 From: Emi Lu Reply-To: emilu@encs.concordia.ca User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: Adrian Klaver CC: pgsql-sql@postgresql.org Subject: Re: Load UTF8@psql into latin1@mysql through JDBC References: <50C8BB30.3000402@encs.concordia.ca> <50C8BFCC.4060100@gmail.com> <50C8C325.3070809@encs.concordia.ca> In-Reply-To: <50C8C325.3070809@encs.concordia.ca> Content-Type: text/plain; charset=ISO-8859-1; format=flowed X-Scanned-By: MIMEDefang 2.58 on oldperseverance.encs.concordia.ca at 2012/12/12 13:06:57 EST Content-Transfer-Encoding: quoted-printable X-MIME-Autoconverted: from 8bit to quoted-printable by oldperseverance.encs.concordia.ca id qBCI6vo9025171 X-Pg-Spam-Score: -4.2 (----) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-sql Precedence: bulk Sender: pgsql-sql-owner@postgresql.org On 12/12/2012 12:47 PM, Emi Lu wrote: >>> Is there a simple way to load UTF8 data in psql to mysql(with latin1 >>> encoding) through JDBC? >> >> This would seem to be dependent on the MySQL JDBC adapter. >> >>> From here: >> >> http://dev.mysql.com/doc/refman/5.1/en/connector-j-reference-charsets.ht= ml >> >> >> "All strings sent from the JDBC driver to the server are >> converted automatically from native Java Unicode form to >> the client character encoding, including all queries sent.... " > > This does not help. The reason I asked this is because through mybatis + > JDBC, loading data from psql@utf8 to mysql@latin1, the french character > cannot be auto-loaded. > JAVA codes work for most of characters, but not "-=C8". Someone knows why= =20 the following codes cannot load "-=C8" to mysql@latin1? Thanks a lot! -- public static String utf8_to_latin1(String str) throws Exception { try { String stringToConvert =3D str; byte[] convertStringToByte =3D stringToConvert.getBytes("UTF-8"); return new String(convertStringToByte, "ISO-8859-1"); }catch(Exception e) { log.error("utf8_to_latin1 Error: " + e.getMessage()); log.error(e); throw e; } } --=20 Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql