diff --git a/org/postgresql/Connection.java b/org/postgresql/Connection.java
index <HASH>..<HASH> 100644
--- a/org/postgresql/Connection.java
+++ b/org/postgresql/Connection.java
@@ -267,7 +267,8 @@ public abstract class Connection
       //
       firstWarning = null;
 
-      java.sql.ResultSet initrset = ExecSQL("set datestyle to 'ISO'; select getdatabaseencoding()");
+      java.sql.ResultSet initrset = ExecSQL("set datestyle to 'ISO'; " +
+        "select case when pg_encoding_to_char(1) = 'SQL_ASCII' then 'UNKNOWN' else getdatabaseencoding() end");
 
       String dbEncoding = null;
       //retrieve DB properties
@@ -319,6 +320,11 @@ public abstract class Connection
 
         } else if (dbEncoding.equals("WIN")) {
           dbEncoding = "Cp1252";
+        } else if (dbEncoding.equals("UNKNOWN")) {
+          //This isn't a multibyte database so we don't have an encoding to use
+          //We leave dbEncoding null which will cause the default encoding for the
+          //JVM to be used
+          dbEncoding = null;
         } else {
           dbEncoding = null;
         }
The following patch for JDBC fixes an issue with jdbc running on a
non-multibyte database loosing 8bit characters.  This patch will cause
the jdbc driver to ignore the encoding reported by the database when
multibyte isn't enabled and use the JVM default in that case.

Barry Lind