code: public static final String getResourceEncoding(CmsObject cms, CmsResource res) {
  
          String encoding = null;
          // get the encoding
          try {
              encoding = cms.readPropertyObject(res, CmsPropertyDefinition.PROPERTY_CONTENT_ENCODING, true).getValue();
              if (encoding != null) {
                  encoding = CmsEncoder.lookupEncoding(encoding.trim(), encoding);
              }
          } catch (CmsException e) {
              if (LOG.isInfoEnabled()) {
                  LOG.info(Messages.get().getBundle().key(Messages.ERR_READ_ENCODING_PROP_1, res.getRootPath()), e);
              }
          }
          if (encoding == null) {
              encoding = OpenCms.getSystemInfo().getDefaultEncoding();
          }
          return encoding;
      }
docs: Returns the content encoding set for the given resource.<p>
  
  The content encoding is controlled by the property {@link CmsPropertyDefinition#PROPERTY_CONTENT_ENCODING},
  which can be set on the resource or on a parent folder for all resources in this folder.<p>
  
  In case no encoding has been set, the default encoding from
  {@link org.opencms.main.CmsSystemInfo#getDefaultEncoding()} is returned.<p>
  
  @param cms the current OpenCms user context
  @param res the resource to read the encoding for
  
  @return the content encoding set for the given resource