docs: private static void updateFile(CmsObject cms, CmsFile file, CmsMacroResolver macroResolver) throws CmsException {
  
          String encoding = cms.readPropertyObject(file, CmsPropertyDefinition.PROPERTY_CONTENT_ENCODING, true).getValue(
              OpenCms.getSystemInfo().getDefaultEncoding());
          String content;
          try {
              content = macroResolver.resolveMacros(new String(file.getContents(), encoding));
          } catch (UnsupportedEncodingException e) {
              try {
                  content = macroResolver.resolveMacros(
                      new String(file.getContents(), Charset.defaultCharset().toString()));
              } catch (UnsupportedEncodingException e1) {
                  content = macroResolver.resolveMacros(new String(file.getContents()));
              }
          }
          // update the content
          try {
              file.setContents(content.getBytes(encoding));
          } catch (UnsupportedEncodingException e) {
              try {
                  file.setContents(content.getBytes(Charset.defaultCharset().toString()));
              } catch (UnsupportedEncodingException e1) {
                  file.setContents(content.getBytes());
              }
          }
          // write the target file
          cms.writeFile(file);
      }