text/rtf means: text/rtf is an alias media type for Rich Text Format documents, sometimes emitted instead of application/rtf. It identifies the same RTF styled-text format; the application/rtf form is more common, but text/rtf appears in legacy systems and certain mail clients. Text media types carry human-readable character data. Because they are text, the charset parameter matters: without an explicit charset=utf-8, receivers may guess a legacy encoding and mangle non-ASCII characters. Text types are also the ones browsers render or display inline, so the subtype decides whether content is treated as markup, code, or plain prose. You will encounter text/rtf in contexts such as legacy rtf document interchange; mail clients emitting text/rtf for rich text; systems aliasing rtf under the text tree. It is commonly associated with the file extension(s) .rtf. RTF is fundamentally a structured format despite the text/ prefix; treating it as plain text shows control words. Prefer application/rtf for new systems, and accept text/rtf as equivalent when consuming legacy content.
When you'll see text/rtf
- Legacy RTF document interchange
- Mail clients emitting text/rtf for rich text
- Systems aliasing RTF under the text tree
How to handle it
When serving a text type, always declare charset=utf-8 unless the specification fixes another encoding, and escape or sanitize content according to how it will be rendered. Treat text/html as executable: never inject untrusted strings into it without encoding. For text/plain and text/csv, preserve line endings and quoting rules so downstream parsers do not split fields incorrectly, and set Content-Disposition when you want a download instead of inline display. As a final checklist for text types: declare charset=utf-8 everywhere, normalize line endings for cross-platform consumers, escape output for the rendering context to prevent injection, and set Content-Disposition deliberately so browsers either display inline or download rather than guessing.
Notes & gotchas
RTF is fundamentally a structured format despite the text/ prefix; treating it as plain text shows control words. Prefer application/rtf for new systems, and accept text/rtf as equivalent when consuming legacy content.
Examples
HTTP/1.1 200 OK
Content-Type: text/rtf; charset=utf-8
Content-Length: 71
Sample text/rtf content delivered with the correct Content-Type header. curl -i -H "Accept: text/rtf" https://api.example.com/v1/resource # inspect the returned Content-Type const res = await fetch("/v1/resource", { headers: { Accept: "text/rtf" } });
// verify res.headers.get("Content-Type") starts with "text/rtf"
const text = await res.text(); // handle according to the declared type import requests
res = requests.get("https://api.example.com/v1/resource",
headers={"Accept": "text/rtf"}, timeout=10)
res.raise_for_status()
# confirm the server declared the expected type
assert res.headers["Content-Type"].startswith("text/rtf")
text = res.text # decode/handle according to the type Frequently asked questions
Is text/rtf different from application/rtf?
They describe the same Rich Text Format; application/rtf is the more common registered form. text/rtf is a legacy alias some systems emit.
Can I edit RTF as plain text?
Technically yes since it uses readable characters, but the control words and groups make hand-editing error-prone. Use a word processor or a dedicated RTF library.
Do I need to specify charset for text types?
Yes — append ; charset=utf-8 unless the type defines its own encoding rules. Without it, receivers may fall back to a legacy encoding and corrupt non-ASCII characters. UTF-8 is the safe default for the modern web.
What is the difference between text/plain and text/html?
text/plain is displayed verbatim with no markup interpretation; text/html is parsed as a document, executing styles and scripts. Serving user content as text/html when you meant plain text is a cross-site scripting risk.
Why do my non-ASCII characters appear corrupted?
The receiver guessed the wrong encoding because no charset was declared. Send charset=utf-8 in the Content-Type, ensure the bytes are actually UTF-8, and for HTML add a matching meta charset tag.
Try the Text Diff
Highlight additions and removals between two texts.