!145 characterEncoding增加GB18030支持
Merge pull request !145 from travelliu/characterEncoding_add_gb18030
This commit is contained in:
@ -59,6 +59,7 @@ public class Encoding {
|
||||
encodings.put("SJIS", new String[]{"MS932", "SJIS"});
|
||||
encodings.put("BIG5", new String[]{"Big5", "MS950", "Cp950"});
|
||||
encodings.put("GBK", new String[]{"GBK", "MS936"});
|
||||
encodings.put("GB18030", new String[]{"GB18030"});
|
||||
encodings.put("UHC", new String[]{"MS949", "Cp949", "Cp949C"});
|
||||
encodings.put("TCVN", new String[]{"Cp1258"});
|
||||
encodings.put("WIN1256", new String[]{"Cp1256"});
|
||||
|
||||
@ -84,6 +84,7 @@ public class ConnectionFactoryImpl extends ConnectionFactory {
|
||||
CLIENT_ENCODING_WHITELIST.put("UTF8", "UTF8");
|
||||
CLIENT_ENCODING_WHITELIST.put("UTF-8", "UTF-8");
|
||||
CLIENT_ENCODING_WHITELIST.put("GBK", "GBK");
|
||||
CLIENT_ENCODING_WHITELIST.put("GB18030", "GB18030");
|
||||
CLIENT_ENCODING_WHITELIST.put("LATIN1", "LATIN1");
|
||||
}
|
||||
// public static void setStaticClientEncoding(String client) {
|
||||
|
||||
@ -89,6 +89,16 @@ public class TestUtil {
|
||||
ssl = "&ssl=" + getSSL();
|
||||
}
|
||||
|
||||
String characterEncoding = "";
|
||||
if (getCharacterEncoding() != null && !getCharacterEncoding().equals("")) {
|
||||
characterEncoding = "&characterEncoding=" + getCharacterEncoding();
|
||||
}
|
||||
|
||||
String allowEncodingChanges = "";
|
||||
if (getAllowEncodingChanges() != null && !getAllowEncodingChanges().equals("")) {
|
||||
allowEncodingChanges = "&allowEncodingChanges=" + getAllowEncodingChanges();
|
||||
}
|
||||
|
||||
return "jdbc:postgresql://"
|
||||
+ hostport + "/"
|
||||
+ database
|
||||
@ -99,7 +109,7 @@ public class TestUtil {
|
||||
+ binaryTransfer
|
||||
+ receiveBufferSize
|
||||
+ sendBufferSize
|
||||
+ ssl;
|
||||
+ ssl + allowEncodingChanges + characterEncoding;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -208,6 +218,20 @@ public class TestUtil {
|
||||
return System.getProperty("loggerLevel");
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the allowEncodingChanges
|
||||
*/
|
||||
public static String getAllowEncodingChanges() {
|
||||
return System.getProperty("allowEncodingChanges");
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the characterEncoding
|
||||
*/
|
||||
public static String getCharacterEncoding() {
|
||||
return System.getProperty("characterEncoding");
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns the log file to use
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user