java UTF8 etc. (Re: Upgrading driver from 7.4 to 8.1) - Mailing list pgsql-jdbc

From Marc Herbert
Subject java UTF8 etc. (Re: Upgrading driver from 7.4 to 8.1)
Date
Msg-id khjmzd1ku13.fsf_-_@meije.emic.fr
Whole thread Raw
In response to Upgrading driver from 7.4 to 8.1  ("Markus Wollny" <Markus.Wollny@computec.de>)
List pgsql-jdbc
Tom Lane <tgl@sss.pgh.pa.us> writes:

> FWIW, I think that Java clients don't need to worry about those security
> issues.  It's not possible for Java to emit an invalidly-coded UTF8
> string, is it?  I thought that the internal representation of strings
> is UCS2 or UCS4, and if so, it would take some exceedingly broken
> code in the JVM for the output not to be valid UTF8.

It's UTF-16, just like Windows XP and above.

 http://java.sun.com/developer/technicalArticles/Intl/Supplementary/

FYI there are two ways to output UTF8:

DataOutputStream.writeUTF()
 outputs a non-standard UTF8, and is limited in size.

From 1.4:
 Charset.forName("UTF-8")....encode()
  outputs standard UTF8



pgsql-jdbc by date:

Previous
From: Markus Schaber
Date:
Subject: Re: Security hole in 8.1.3 with respect to invalidly-encoded
Next
From: "Markus Wollny"
Date:
Subject: Re: Upgrading driver from 7.4 to 8.1