Re: JDBC to load UTF8@psql to latin1@mysql - Mailing list pgsql-general

From Emi Lu
Subject Re: JDBC to load UTF8@psql to latin1@mysql
Date
Msg-id 50C8CABE.5060203@encs.concordia.ca
Whole thread Raw
In response to JDBC to load UTF8@psql to latin1@mysql  (Emi Lu <emilu@encs.concordia.ca>)
Responses Re: JDBC to load UTF8@psql to latin1@mysql  (Paul Jungwirth <pj@illuminatedcomputing.com>)
List pgsql-general
> 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)
    throws Exception
    {
       try
       {
          String stringToConvert = str;
          byte[] convertStringToByte = 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;
       }
    }


pgsql-general by date:

Previous
From: Mihai Popa
Date:
Subject: Re: large database
Next
From: Sergey Konoplev
Date:
Subject: Re: NOTIFY/LISTEN on server, asynchronous processing