diff -u postgresql/Connection.java postgresql_new/Connection.java --- postgresql/Connection.java Wed Apr 15 17:40:46 1998 +++ postgresql_new/Connection.java Wed Apr 15 15:22:47 1998 @@ -208,8 +208,10 @@ pg_stream.SendInteger(4+4+SM_DATABASE+SM_USER+SM_OPTIONS+SM_UNUSED+SM_TTY,4); pg_stream.SendInteger(PG_PROTOCOL_LATEST_MAJOR,2); pg_stream.SendInteger(PG_PROTOCOL_LATEST_MINOR,2); - pg_stream.Send(database.getBytes(),SM_DATABASE); - pg_stream.Send(PG_USER.getBytes(),SM_USER+SM_OPTIONS+SM_UNUSED+SM_TTY); + //pg_stream.Send(database.getBytes(),SM_DATABASE); + pg_stream.Send(database.getBytes("EUCJIS"),SM_DATABASE); + //pg_stream.Send(PG_USER.getBytes(),SM_USER+SM_OPTIONS+SM_UNUSED+SM_TTY); + pg_stream.Send(PG_USER.getBytes("EUCJIS"),SM_USER+SM_OPTIONS+SM_UNUSED+SM_TTY); // The last send includes the unused fields // Now get the response from the backend, either an error message @@ -664,7 +666,8 @@ { Field[] fields = null; Vector tuples = new Vector(); - byte[] buf = new byte[sql.length()]; + //byte[] buf = new byte[sql.length()]; + byte[] buf = new byte[sql.length()*2]; int fqp = 0; boolean hfr = false; String recv_status = null, msg; @@ -675,7 +678,8 @@ try { pg_stream.SendChar('Q'); - buf = sql.getBytes(); + //buf = sql.getBytes(); + buf = sql.getBytes("EUCJIS"); pg_stream.Send(buf); pg_stream.SendChar(0); } catch (IOException e) { diff -u postgresql/PG_Stream.java postgresql_new/PG_Stream.java --- postgresql/PG_Stream.java Wed Apr 15 17:40:46 1998 +++ postgresql_new/PG_Stream.java Wed Apr 15 15:22:47 1998 @@ -19,7 +19,9 @@ public class PG_Stream { private Socket connection; + //private InputStreamReader pg_input; private InputStream pg_input; + //private OutputStreamWriter pg_output; private OutputStream pg_output; /** @@ -34,7 +36,11 @@ { connection = new Socket(host, port); pg_input = connection.getInputStream(); + //pg_input_native = connection.getInputStream(); + //pg_input = new InputStreamReader(pg_input_native); pg_output = connection.getOutputStream(); + //pg_output_native = connection.getOutputStream(); + //pg_output = new OutputStreamWriter(pg_output_native); } /** @@ -48,7 +54,7 @@ //pg_output.write(val); byte b[] = new byte[1]; b[0] = (byte)val; - pg_output.write(b); + pg_output.write(b,0,b.length); } /** @@ -102,7 +108,7 @@ */ public void Send(byte buf[]) throws IOException { - pg_output.write(buf); + pg_output.write(buf,0,buf.length); } /** @@ -257,7 +263,13 @@ } catch (IOException e) { throw new SQLException("Error reading from backend: " + e.toString()); } - String v = new String(rst, 0, s); + //String v = new String(rst, 0, s); + String v = null; + try{ + v = new String(rst, 0, s, "EUCJIS"); + }catch( UnsupportedEncodingException e ){ + throw new SQLException("Error converting EUC to UNICODE: " + e.toString()); + } return v; } diff -u postgresql/ResultSet.java postgresql_new/ResultSet.java --- postgresql/ResultSet.java Wed Apr 15 17:40:47 1998 +++ postgresql_new/ResultSet.java Wed Apr 15 15:22:47 1998 @@ -161,7 +161,15 @@ wasNullFlag = (this_row[columnIndex - 1] == null); if(wasNullFlag) return null; - return new String(this_row[columnIndex - 1]); + //return new String(this_row[columnIndex - 1]); + String str = null; + try{ + str = new String(this_row[columnIndex - 1], "EUCJIS"); + }catch(UnsupportedEncodingException e){ + throw new SQLException("getString() EUCJIS to UNICODE error: "+e.toString()); + } + + return str; } /** Common subdirectories: postgresql/fastpath and postgresql_new/fastpath Common subdirectories: postgresql/geometric and postgresql_new/geometric Common subdirectories: postgresql/largeobject and postgresql_new/largeobject Common subdirectories: postgresql/util and postgresql_new/util