code: private String escapeAndQuote(String value) {
          // the initial count is for the preceding and trailing quotes
          int count = 2;
          for (int i = 0; i < value.length(); i++) {
              switch (value.charAt(i)) {
                  case '\"':
                  case '\n':
                  case '\r':
                  case '\\':
                      count++;
                      break;
                  default:
                      break;
              }
          }
          StringBuffer sb = new StringBuffer(value.length() + count);
          sb.append(strategy.getEncapsulator());
          for (int i = 0; i < value.length(); i++) {
              char c = value.charAt(i);
  
              if (c == strategy.getEncapsulator()) {
                  sb.append('\\').append(c);
                  continue;
              }
              switch (c) {
                  case '\n':
                      sb.append("\\n");
                      break;
                  case '\r':
                      sb.append("\\r");
                      break;
                  case '\\':
                      sb.append("\\\\");
                      break;
                  default:
                      sb.append(c);
              }
          }
          sb.append(strategy.getEncapsulator());
          return sb.toString();
      }
docs: Enclose the value in quotes and escape the quote
  and comma characters that are inside.
  
  @param value needs to be escaped and quoted
  @return the value, escaped and quoted