private static String backslashEscapeQuotes(String s) {
    assert !s.isEmpty();

    String result = WIN_BACKSLASHES_PRECEDING_QUOTE.matcher(s)
      .replaceAll("$1$1")      // duplicate trailing backslashes and those preceding a double quote
      .replace("\"", "\\\"");  // backslash-escape all double quotes

    if (!result.equals(s) || WIN_QUOTE_SPECIAL.matcher(s).find()) {
      result = quote(result, Q);
    }

    return result;
  }
private static String backslashEscapeQuotes(String s)