Added a new private method getCharSetFromConnection() which checks if the connection charset is null and if it is null, returns StringUtils.getPreferredCharset regression caused by commit f03411ca0436c8b52f5e60b0c8820fd1d1ba2ff6