Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-jdbc by date

Next:From: Oliver JowettDate: 2008-08-01 23:18:45
Subject: Re: Encoding issues
Previous:From: tivvpgsqljdbcDate: 2008-07-30 09:12:20
Subject: Re: numeric type

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group