code: @Override
      public String convertToString(String htmlInput) throws UnsupportedEncodingException {
  
          // initialize the modes
          initModes();
          // only do parsing if the mode is not set to disabled
          if (m_modeEnabled) {
  
              // do a maximum of 10 loops
              int max = m_modeWord ? 10 : 1;
              int count = 0;
  
              // we may have to do several parsing runs until all tags are removed
              int oldSize = htmlInput.length();
              String workHtml = regExp(htmlInput);
              while (count < max) {
                  count++;
  
                  // first add the optional header if in word mode
                  if (m_modeWord) {
                      workHtml = adjustHtml(workHtml);
                  }
                  // now use tidy to parse and format the HTML
                  workHtml = parse(workHtml);
                  if (m_modeWord) {
                      // cut off the line separator, which is always appended
                      workHtml = workHtml.substring(0, workHtml.length() - m_lineSeparatorLength);
                  }
  
                  if (workHtml.length() == oldSize) {
                      // no change in HTML code after last processing loop
                      workHtml = regExp(workHtml);
                      break;
                  }
                  oldSize = workHtml.length();
                  workHtml = regExp(workHtml);
              }
              if (LOG.isDebugEnabled()) {
                  LOG.debug(
                      Messages.get().getBundle().key(
                          Messages.LOG_PARSING_RUNS_2,
                          this.getClass().getName(),
                          new Integer(count)));
              }
              htmlInput = workHtml;
          }
  
          return htmlInput;
      }
docs: Converts the given HTML code according to the settings of this converter.<p>
  
  @param htmlInput HTML input stored in a string
  @return string containing the converted HTML
  
  @throws UnsupportedEncodingException if the encoding set for the conversion is not supported