code: protected String getFileEncoding(CmsObject cms, CmsResource file) {
  
          String result;
          try {
              result = cms.readPropertyObject(file, CmsPropertyDefinition.PROPERTY_CONTENT_ENCODING, true).getValue(
                  OpenCms.getSystemInfo().getDefaultEncoding());
          } catch (CmsException e) {
              result = OpenCms.getSystemInfo().getDefaultEncoding();
          }
          return CmsEncoder.lookupEncoding(result, OpenCms.getSystemInfo().getDefaultEncoding());
      }
docs: Helper method to determine the encoding of the given file in the VFS,
  which must be set using the "content-encoding" property.<p>
  
  @param cms the CmsObject
  @param file the file which is to be checked
  @return the encoding for the file