Encoding issues

From: Jeff Davis <pgsql(at)j-davis(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Encoding issues
Date: 2008-08-01 18:05:20
Message-ID: 1217613920.16813.168.camel@dell.linuxdev.us.dell.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc


MD5Digest.encode() calls password.getBytes("US-ASCII") and the same for
the username. This is wrong, because when java converts a non-ASCII
character to US-ASCII, it replaces it with a "?".

Similarly for sendStartupPacket()
in /org/postgresql/core/v3/ConnectionFactoryImpl.java
and /org/postgresql/core/v2/ConnectionFactoryImpl.java.

I'm not sure exactly what it _should_ do, because the connection itself
is done with ASCII (client_encoding is not yet set).

Rather than trying to convert from characters to ASCII, maybe it should
just get the byte sequence, and send that? That appears to be how other
clients (like libpq) work.

It still fails when the client and server encoding don't match, however.

Regards,
Jeff Davis

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Oliver Jowett 2008-08-01 23:18:45 Re: Encoding issues
Previous Message tivvpgsqljdbc 2008-07-30 09:12:20 Re: numeric type