How to Avoid Spurious "QuestionMark" characters from LONG or CLOB data when the data contains extended ACII characters

For Any java platform using character set "Cp1252"

Java's default character set for Windows is "Cp1252", which usually translates extended ASCII characters fine (i.e., ASCII characters whose decimal value is over 127). As an aside, lots of people write HTML on the Windows platform, but the web servers are running some version of UNIX/LINUX, so the character set issue still applies. This is really the cause of the problem.

However, with JDBC and Oracle LONG and CLOB datatypes, a "getString(X)" will produce a String that erroneously translates the extended ASCII characters to "?" question marks.

The Workaround

An easy workaround, rather that doing "getString(X), do something like the following

	xSQLStatement.executeQuery("select CLOB_OR_LONG_COLUMB from MyTable where ....");
	ResultSet xRS = xSQLStatement.getResultSet();
	xRE.next();
	byte[] aAbout = xRS.getBytes(1);
	sAbout = new String(aAbout, "Cp1252"); 
	xRS.close();
	xSQLStatement.close();

Note, using "getBytes(X)", and explicitly converting the string using the "Cp1252" character set. I dunno whether this is an oracle JDBC bug or a Java bug, but this handles the problem.

A better solution is to catch the extended ASCII characters before writing to the database, and translating them to HTML (although one could run out of column space doing same).