Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add algorithm to extract an encoding from a MIME type #1447

Merged
merged 2 commits into from
Jun 1, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions fetch.bs
Original file line number Diff line number Diff line change
Expand Up @@ -3491,6 +3491,30 @@ Content-Type:
</table>
</div>

<p>To <dfn export>legacy extract an encoding</dfn> given failure or a <a for=/>MIME type</a>
<var>mimeType</var> and an <a for=/>encoding</a> <var>fallbackEncoding</var>, run these steps:

<ol>
<li><p>If <var>mimeType</var> is failure, then return <var>fallbackEncoding</var>.

<li><p>If <var>mimeType</var>["<code>charset</code>"] does not <a for=map>exist</a>, then return
<var>fallbackEncoding</var>.

<li><p>Let <var>tentativeEncoding</var> be the result of <a for=/>getting an encoding</a> from
<var>mimeType</var>["<code>charset</code>"].

<li><p>If <var>tentativeEncoding</var> is failure, then return <var>fallbackEncoding</var>.

<li><p>Return <var>tentativeEncoding</var>.
</ol>

<div class=note>
<p>This algorithm allows <var>mimeType</var> to be failure so it can be more easily combined with
<a>extract a MIME type</a>.

<p>It is denoted as legacy as modern formats are to exclusively use <a for=/>UTF-8</a>.
</div>


<h3 id=x-content-type-options-header>`<code>X-Content-Type-Options</code>` header</h3>

Expand Down