code: public static boolean needsQuoting(byte[] data, int off, int len) {
      for(int i=off; i< off+len; ++i) {
        switch(data[i]) {
        case '&':
        case '<':
        case '>':
        case '\'':
        case '"':
          return true;
        default:
          break;
        }
      }
      return false;
    }
docs: Does the given string need to be quoted?
  @param data the string to check
  @param off the starting position
  @param len the number of bytes to check
  @return does the string contain any of the active html characters?