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 f03411ca04
f03411ca04