Re: [GENERAL] JDBC to load UTF8@psql to latin1@mysql

2012-12-14 Thread Emi Lu
On 12/14/2012 01:37 PM, Emi Lu wrote: Hello All, Meh. That character renders as \310 in your mail, which is not an assigned code in ISO 8859-1. The numerically corresponding Unicode value would be U+0090, which is an unspecified control character. Oh, scratch that, apparently I can't do hex/

Re: [GENERAL] JDBC to load UTF8@psql to latin1@mysql

2012-12-14 Thread Emi Lu
Hello All, Meh. That character renders as \310 in your mail, which is not an assigned code in ISO 8859-1. The numerically corresponding Unicode value would be U+0090, which is an unspecified control character. Oh, scratch that, apparently I can't do hex/octal arithmetic in my head first thing

Re: [GENERAL] JDBC to load UTF8@psql to latin1@mysql

2012-12-14 Thread Adrian Klaver
On 12/14/2012 07:35 AM, Tom Lane wrote: I wrote: Meh. That character renders as \310 in your mail, which is not an assigned code in ISO 8859-1. The numerically corresponding Unicode value would be U+0090, which is an unspecified control character. Oh, scratch that, apparently I can't do hex/

Re: [GENERAL] JDBC to load UTF8@psql to latin1@mysql

2012-12-14 Thread Tom Lane
I wrote: > Meh. That character renders as \310 in your mail, which is not an > assigned code in ISO 8859-1. The numerically corresponding Unicode > value would be U+0090, which is an unspecified control character. Oh, scratch that, apparently I can't do hex/octal arithmetic in my head first thin

Re: [GENERAL] JDBC to load UTF8@psql to latin1@mysql

2012-12-14 Thread Tom Lane
Emi Lu writes: > For now, through the following method, all letters are correctly > transformed except "È". Meh. That character renders as \310 in your mail, which is not an assigned code in ISO 8859-1. The numerically corresponding Unicode value would be U+0090, which is an unspecified contro

Re: [GENERAL] JDBC to load UTF8@psql to latin1@mysql

2012-12-14 Thread Emi Lu
On 12/14/2012 09:49 AM, Adrian Klaver wrote: Original Poster Thanks. And more info: Mysql +--++ | Variable_name| Value | +--++ | character_set_client | latin1 | | character_set_connection | latin1 | | character_set_

Re: [GENERAL] JDBC to load UTF8@psql to latin1@mysql

2012-12-14 Thread Adrian Klaver
On 12/14/2012 06:06 AM, Emi Lu wrote: What does OP stand for? Original Poster. Emi -- -- Adrian Klaver adrian.kla...@gmail.com -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

Re: [GENERAL] JDBC to load UTF8@psql to latin1@mysql

2012-12-14 Thread Emi Lu
Yeah, I agree this is the right answer here, since you're using JDBC. By the time you get a String from the MySQL driver, it's already in Java's 2-bytes-per-char format. And the Postgres driver will deal with the encoding on the output side. So the code I provided won't help you. I'm afraid I don'

Re: [GENERAL] JDBC to load UTF8@psql to latin1@mysql

2012-12-13 Thread Tom Lane
Paul Jungwirth writes: > Yeah, I agree this is the right answer here, since you're using JDBC. By > the time you get a String from the MySQL driver, it's already in Java's > 2-bytes-per-char format. And the Postgres driver will deal with the > encoding on the output side. So the code I provided wo

Re: [GENERAL] JDBC to load UTF8@psql to latin1@mysql

2012-12-13 Thread Thomas Kellerer
Emi Lu wrote on 13.12.2012 15:00: Is there a simple way to load UTF8 data in psql to mysql(with latin1 encoding) through JDBC? All you need to do is to query the source database, then use ResultSet.getString() to obtain the data and use a PreparedStatement and PreparedStatement.setString() to

Re: [GENERAL] JDBC to load UTF8@psql to latin1@mysql

2012-12-13 Thread Paul Jungwirth
> The JDBC drivers will handle all the conversion. > Do NOT manually convert the data. Yeah, I agree this is the right answer here, since you're using JDBC. By the time you get a String from the MySQL driver, it's already in Java's 2-bytes-per-char format. And the Postgres driver will deal with th

Re: [GENERAL] JDBC to load UTF8@psql to latin1@mysql

2012-12-13 Thread Emi Lu
I don't think your Java code does what you think it does. You should read some more about how Java handles string encodings. Here is a method I wrote some years ago that might also help you. It converts streams, not strings, but what you need should be pretty close (and simpler): /** * Inte

Re: [GENERAL] JDBC to load UTF8@psql to latin1@mysql

2012-12-13 Thread Edson Richter
Em 13/12/2012 12:00, Emi Lu escreveu: Is there a simple way to load UTF8 data in psql to mysql(with latin1 encoding) through JDBC? All you need to do is to query the source database, then use ResultSet.getString() to obtain the data and use a PreparedStatement and PreparedStatement.setString(

Re: [GENERAL] JDBC to load UTF8@psql to latin1@mysql

2012-12-13 Thread Emi Lu
Is there a simple way to load UTF8 data in psql to mysql(with latin1 encoding) through JDBC? All you need to do is to query the source database, then use ResultSet.getString() to obtain the data and use a PreparedStatement and PreparedStatement.setString() to insert/update the data on the tar

Re: [GENERAL] JDBC to load UTF8@psql to latin1@mysql

2012-12-12 Thread Thomas Kellerer
Emi Lu wrote on 12.12.2012 17:17: Good morning, Is there a simple way to load UTF8 data in psql to mysql(with latin1 encoding) through JDBC? All you need to do is to query the source database, then use ResultSet.getString() to obtain the data and use a PreparedStatement and PreparedStatemen

Re: [GENERAL] JDBC to load UTF8@psql to latin1@mysql

2012-12-12 Thread Paul Jungwirth
I don't think your Java code does what you think it does. You should read some more about how Java handles string encodings. Here is a method I wrote some years ago that might also help you. It converts streams, not strings, but what you need should be pretty close (and simpler): /** * Interp

Re: [GENERAL] JDBC to load UTF8@psql to latin1@mysql

2012-12-12 Thread Emi Lu
Is there a simple way to load UTF8 data in psql to mysql(with latin1 encoding) through JDBC? JAVA codes work for most of characters, but not "-È". Someone knows why the following codes cannot load "-È" to mysql@latin1? Thanks a lot! -- public static String utf8_to_latin1(String str) thro