docs: public String escapeHTMLString(String s)
      {
          if (s == null)
          {
              return null;
          }
          
          StringBuilder buffer = new StringBuilder();
          for(int i = 0; i < s.length(); i++)
          {
              char ch = s.charAt(i);
              switch (ch)
              {
                  case ' ':
                      // All spaces in a block of consecutive spaces are converted to
                      // non-breaking space (&nbsp;) except for the last one.  This allows
                      // significant whitespace to be retained without prohibiting wrapping.
                      char nextCh = i + 1 < s.length() ? s.charAt(i + 1) : 0;
                      buffer.append(nextCh==' ' ? "&nbsp;" : " ");
                      break;
                  case '\n':
                      buffer.append("<br/>\n");
                      break;
                  default:
                      buffer.append(escapeChar(ch));
              }
          }
          return buffer.toString();
      }