private static void escapeQuotationsInFilename(StringBuilder sb, String filename) {
        if (filename.indexOf('"') == -1 && filename.indexOf('\\') == -1) {
            sb.append(filename);
            return;
        }

        boolean escaped = false;
        for (char c : filename.toCharArray()) {
            if (!escaped && c == '"') {
                sb.append("\\\"");
            } else {
                sb.append(c);
            }
            escaped = !escaped && c == '\\';
        }
        // Remove backslash at the end..
        if (escaped) {
            sb.deleteCharAt(sb.length() - 1);
        }
    }
Decodes the given header field param as described in RFC 5987.

<p>Only the US-ASCII, UTF-8 and ISO-8859-1 charsets are supported.

@param filename the filename
@param charset the charset for the filename
@return the encoded header field param

@see <a href="https://datatracker.ietf.org/doc/rfc5987/">RFC 5987</a>
core/src/main/java/com/linecorp/armeria/common/ContentDisposition.java