code: protected String getConfiguredEncoding(CmsObject cms, CmsResource resource) throws CmsException {
  
          String encoding = null;
          try {
              encoding = cms.readPropertyObject(
                  resource.getRootPath(),
                  CmsPropertyDefinition.PROPERTY_CONTENT_ENCODING,
                  true).getValue();
          } catch (CmsException e) {
              // encoding will be null
          }
          if (encoding == null) {
              encoding = OpenCms.getSystemInfo().getDefaultEncoding();
          } else {
              encoding = CmsEncoder.lookupEncoding(encoding, null);
              if (encoding == null) {
                  throw new CmsXmlException(
                      Messages.get().container(Messages.ERR_XMLCONTENT_INVALID_ENC_1, resource.getRootPath()));
              }
          }
          return encoding;
      }
docs: Gets the encoding which is configured at the location of a given resource.<p>
  
  @param cms the current CMS context
  @param resource the resource for which the configured encoding should be retrieved
  @return the configured encoding for the resource
  
  @throws CmsException if something goes wrong