code: public static String getEncoding(CmsObject cms, CmsResource file) {
  
          CmsProperty encodingProperty = CmsProperty.getNullProperty();
          try {
              encodingProperty = cms.readPropertyObject(file, CmsPropertyDefinition.PROPERTY_CONTENT_ENCODING, true);
          } catch (CmsException e) {
              LOG.debug(e.getLocalizedMessage(), e);
          }
          return CmsEncoder.lookupEncoding(encodingProperty.getValue(""), OpenCms.getSystemInfo().getDefaultEncoding());
      }
docs: Returns the encoding of the file.
  Encoding is read from the content-encoding property and defaults to the systems default encoding.
  Since properties can change without rewriting content, the actual encoding can differ.
  
  @param cms {@link CmsObject} used to read properties of the given file.
  @param file the file for which the encoding is requested
  @return the file's encoding according to the content-encoding property, or the system's default encoding as default.