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 50CB3E05.4060509@encs.concordia.ca
Whole thread Raw
In response to Re: JDBC to load UTF8@psql to latin1@mysql  (Adrian Klaver <adrian.klaver@gmail.com>)
List pgsql-general
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_database   | latin1 |
| character_set_filesystem | binary |
| character_set_results    | latin1 |
| character_set_server     | latin1 |
| character_set_system     | utf8   |
+--------------------------+--------+
SHOW VARIABLES LIKE "character\_set\_database";
+------------------------+--------+
| Variable_name          | Value  |
+------------------------+--------+
| character_set_database | latin1 |
+------------------------+--------+

Psql everywhere is utf8.

Where could be the problem located?

Also by using the java encoding methods, all characters except "È" are
transformed correctly.

Thanks alot!
Emi
--
public static String utf8_to_latin1(String str)
    throws Exception
    {
       try
       {
          if(str.indexOf("È")>=0)
          {
             str = str.replaceAll("È", "E");
          }
          byte[] convertStringToByte = str.getBytes("UTF-8");
          str                        = new String(convertStringToByte,
"ISO-8859-1");
          return str;
       }catch(Exception e)
       {
          log.error("utf8_to_latin1 Error: " + e.getMessage());
          log.error(e);
          throw e;
       }
    }



pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: Problem starting PG-9.2 on non-default port
Next
From: Tom Lane
Date:
Subject: Re: JDBC to load UTF8@psql to latin1@mysql