code: private static String getContentEncoding(URL url) throws IOException {
          URLConnection urlConnection = url.openConnection();
          String encoding = urlConnection.getContentEncoding();
          try {
              IOGroovyMethods.closeQuietly(urlConnection.getInputStream());
          } catch (IOException ignore) {
              // For compatibility, ignore exceptions from getInputStream() call
          }
          return encoding;
      }
docs: TODO(jwagenleitner): remove or fix in future release
  
  According to the spec getContentEncoding() returns the Content-Encoding
  HTTP Header which typically carries values such as 'gzip' or 'deflate'
  and is not the character set encoding. For compatibility in 2.4.x,
  this behavior is retained but should be removed or fixed (parse
  charset from Content-Type header) in future releases.
  
  see GROOVY-8056 and https://github.com/apache/groovy/pull/500