Grid of green and red dots: which clients saved the Japanese filename correctly for each Content-Disposition form

You upload quarterly-report-final.txt, share a download link, and the file lands on the customer's disk as something else: a percent-encoded mess, the last part of a URL, or a name with the accents stripped. The header that decides is Content-Disposition, and the clients do not agree on it.

We served the same 16 header variants (three names: one with spaces, one with an accent, one in Japanese) to curl, wget, Chrome and Firefox and looked at the name each one saved. Every client was run, not read about.

The result in one table

Header form (Japanese name)curl -Ocurl -OJwgetwget --content-dispositionChromeFirefox
filename="日本語…" raw UTF-8✗ cjk-raw✓ correct✗ cjk-raw✓ correct✓ correct✓ correct
filename="%E6%97%A5…" percent-encoded✗ cjk-pct✗ %E6%97%A5%E6%9C%AC%E8%AA%9E%E3%81%AE%E3%83%A1%E3%83%A2.txt✗ cjk-pct✓ correct✓ correct✓ correct
filename*=UTF-8''%E6%97%A5… only✗ cjk-star✗ cjk-star✗ cjk-star✓ correct✓ correct✓ correct
filename="memo.txt"; filename*=UTF-8''%E6…✗ cjk-bothASCII fallback: memo.txt✗ cjk-both✓ correct✓ correct✓ correct
no header, name in the URL path✗ %E6%97%A5%E6%9C%AC%E8%AA%9E%E3%81%AE%E3%83%A1%E3%83%A2.txt✗ %E6%97%A5%E6%9C%AC%E8%AA%9E%E3%81%AE%E3%83%A1%E3%83%A2.txt✓ correct✓ correct✓ correct✓ correct
  • Chrome and Firefox saved the right name for every form, even the sloppy ones: raw UTF-8, percent-encoding inside a plain filename, and a name given only in the URL path.
  • curl without -J ignores the header and uses the URL (and does not decode it: you get %E6%97%A5… on disk). With -OJ it reads filename but not filename*: a header with only filename* saved as the URL's last part, and a header with both saved the ASCII fallback.
  • wget ignores Content-Disposition unless you pass --content-disposition; with it, every form was decoded to the right name.
  • Safari was not tested in this run.

The names with spaces and an accent followed the same pattern in the same cells. The one visible difference is curl with both parameters: it saved the ASCII fallback, which for the spaced name is the same text as the real name and so looked right.

The header that works everywhere we tested

RFC 6266 describes it: send a plain ASCII filename for old clients and a filename* with UTF-8 percent-encoding (RFC 5987) for the rest. A client that understands both should pick filename*; one that does not takes the ASCII name. The RFC also says to put filename first and to avoid percent signs in the plain one.

text
attachment; filename="download.txt"; filename*=UTF-8''%E6%97%A5%E6%9C%AC%E8%AA%9E%E3%81%AE%E3%83%A1%E3%83%A2.txt

Here is a small Python helper that builds it, and the two places to use it on an S3-compatible bucket: when you upload the object, or per link on a presigned URL.

python
import unicodedata
from urllib.parse import quote

def content_disposition(name, kind="attachment"):
    """filename for old clients + filename* (RFC 6266 / 5987) for everyone else."""
    ascii_name = unicodedata.normalize("NFKD", name).encode("ascii", "ignore").decode()
    stem, dot, ext = ascii_name.rpartition(".")
    fallback = (stem.strip() or "download") + dot + ext if dot else (ascii_name.strip() or "download")
    fallback = "".join(ch if ch not in '"\\;/' and ord(ch) >= 32 else "_" for ch in fallback)
    return f"{kind}; filename=\"{fallback}\"; filename*=UTF-8''{quote(name, safe='')}"

# store it with the object ...
s3.put_object(Bucket="b", Key="reports/q3.txt", Body=data,
              ContentDisposition=content_disposition("日本語のメモ.txt"))
# ... or choose the name per download link
url = s3.generate_presigned_url("get_object", Params={
    "Bucket": "b", "Key": "reports/q3.txt", "ResponseContentDisposition": content_disposition("Q3 résumé.txt")},
    ExpiresIn=600)
  • S3 stores the Content-Disposition you send on upload and returns it on download. A presigned GET can override it with response-content-disposition, which is how one object gets a different name per customer (AWS documents the override for GetObject).
  • An override only works on a signed request, so it goes in the presigned URL, not on a public link.
  • Check what a bucket really sends with curl -sI <url> and read the Content-Disposition line.

If your users download with curl or wget

  • Tell curl users to run curl -OJ, and make sure the plain filename is a name they can live with, because curl 8.7.1 will never use the UTF-8 one.
  • Tell wget users to add --content-disposition.
  • For scripts, build the output name yourself from your own metadata; it is the only version that does not depend on the client.

For who can open the link at all, see presigned URLs or public files. This article is only about what the file is called when it arrives.

S3-compatible buckets with no egress fees: set the download name once and share the link.

Explore tport.space

Test record and sources

  • Run on 2026-11-15 on macOS: curl 8.7.1 (x86_64-apple-darwin26.0) libcurl/8.7.1 (SecureTransport) LibreSSL/3.3.6 zlib/1.2.12 nghttp2/1.69.0; curl 8.7.1 (x86_64-apple-darwin26.0) libcurl/8.7.1 (SecureTransport) LibreSSL/3.3.6 zlib/1.2.12 nghttp2/1.69.0; GNU Wget 1.25.0 built on darwin27.0.0.; GNU Wget 1.25.0 built on darwin27.0.0.; Google Chrome 157.0.8103.78; Firefox 159.0.1. A small local server on 127.0.0.1 sent the same body with each header as raw bytes. Chrome ran under Playwright and the name is the browser's own suggested download name; Firefox ran under Selenium with a fresh profile and the file name on disk was read back. Names were compared after Unicode normalisation, because macOS may store accents decomposed.
  • This is the header behaviour of clients, tested against a local server, not against tport.space or AWS. Check your own bucket's Content-Disposition with curl -sI.
  • Only these clients and versions were tested. Other versions, Android browsers and mobile apps may differ.
  • Standards: RFC 6266 (filename and filename*, recipients should pick filename* when both are present, appendix D advice on percent signs and parameter order), RFC 5987 (the encoding of filename*). AWS: GetObject (response-content-disposition override).