Skip to content

Commit

Permalink
[giow] (0) Allow authors to override WebSRT's encoding using <track c…
Browse files Browse the repository at this point in the history
…harset>.

git-svn-id: http://svn.whatwg.org/webapps@5414 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Sep 4, 2010
1 parent 0546218 commit fa7d599
Show file tree
Hide file tree
Showing 3 changed files with 129 additions and 68 deletions.
62 changes: 40 additions & 22 deletions complete.html
Expand Up @@ -24060,16 +24060,18 @@ <h4 id=the-track-element><span class=secno>4.8.9 </span>The <dfn><code>track</co
<dt>Content attributes:</dt>
<dd><a href=#global-attributes>Global attributes</a></dd>
<dd><code title=attr-track-kind><a href=#attr-track-kind>kind</a></code></dd>
<dd><code title=attr-track-label><a href=#attr-track-label>label</a></code></dd>
<dd><code title=attr-track-src><a href=#attr-track-src>src</a></code></dd>
<dd><code title=attr-track-charset><a href=#attr-track-charset>charset</a></code></dd>
<dd><code title=attr-track-srclang><a href=#attr-track-srclang>srclang</a></code></dd>
<dd><code title=attr-track-label><a href=#attr-track-label>label</a></code></dd>
<dt>DOM interface:</dt>
<dd>
<pre class=idl>interface <dfn id=htmltrackelement>HTMLTrackElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
attribute DOMString <a href=#dom-track-kind title=dom-track-kind>kind</a>;
attribute DOMString <a href=#dom-track-label title=dom-track-label>label</a>;
attribute DOMString <a href=#dom-track-src title=dom-track-src>src</a>;
attribute DOMString <a href=#dom-track-charset title=dom-track-charset>charset</a>;
attribute DOMString <a href=#dom-track-srclang title=dom-track-srclang>srclang</a>;
attribute DOMString <a href=#dom-track-label title=dom-track-label>label</a>;

readonly attribute <a href=#timedtrack>TimedTrack</a> <a href=#dom-track-track title=dom-track-track>track</a>;
};</pre>
Expand Down Expand Up @@ -24126,6 +24128,14 @@ <h4 id=the-track-element><span class=secno>4.8.9 </span>The <dfn><code>track</co
<a href=#websrt>WebSRT</a> file must be a <a href=#websrt-file-using-cue-text>WebSRT file using cue
text</a>.</p>

<p>If the elements's <a href=#track-url>track URL</a> identifies a
<a href=#websrt>WebSRT</a> resource, then the <dfn id=attr-track-charset title=attr-track-charset><code>charset</code></dfn> attribute may
be specified. If the attribute is set, its value must be a valid
character encoding name, must be an <a href=#ascii-case-insensitive>ASCII
case-insensitive</a> match for the <a href=#preferred-mime-name>preferred MIME
name</a> for that encoding, and must match the character encoding
of the <a href=#websrt>WebSRT</a> file. <a href=#refsIANACHARSET>[IANACHARSET]</a></p>

<p>The <dfn id=attr-track-srclang title=attr-track-srclang><code>srclang</code></dfn>
attribute gives the language of the timed track data. The value must
be a valid BCP 47 language tag. This attribute must be present if
Expand Down Expand Up @@ -24180,11 +24190,11 @@ <h4 id=the-track-element><span class=secno>4.8.9 </span>The <dfn><code>track</co
<a href=#timed-track>timed track</a>'s corresponding <code><a href=#timedtrack>TimedTrack</a></code>
object.</p>

<p>The <dfn id=dom-track-label title=dom-track-label><code>label</code></dfn>, <dfn id=dom-track-src title=dom-track-src><code>src</code></dfn>, and <dfn id=dom-track-srclang title=dom-track-srclang><code>srclang</code></dfn> IDL attributes
must <a href=#reflect>reflect</a> the respective content attributes of the
same name. The <dfn id=dom-track-kind title=dom-track-kind><code>kind</code></dfn>
IDL attributemust <a href=#reflect>reflect</a> the content attribute of the
same name, <a href=#limited-to-only-known-values>limited to only known values</a>.</p>
<p>The <dfn id=dom-track-src title=dom-track-src><code>src</code></dfn>, <dfn id=dom-track-charset title=dom-track-charset><code>charset</code></dfn>, <dfn id=dom-track-srclang title=dom-track-srclang><code>srclang</code></dfn>, and <dfn id=dom-track-label title=dom-track-label><code>label</code></dfn> IDL attributes must
<a href=#reflect>reflect</a> the respective content attributes of the same
name. The <dfn id=dom-track-kind title=dom-track-kind><code>kind</code></dfn> IDL
attributemust <a href=#reflect>reflect</a> the content attribute of the same
name, <a href=#limited-to-only-known-values>limited to only known values</a>.</p>

</div>

Expand Down Expand Up @@ -27173,8 +27183,13 @@ <h6 id=sourcing-out-of-band-timed-tracks><span class=secno>4.8.10.10.3 </span>So
unsupported (this causes the load to fail, as described below). If
a type is obtained, and represents a supported timed track format,
then the resource's data must be passed to the appropriate parser
as it is received, with the <a href=#timed-track-list-of-cues>timed track list of cues</a>
being used for that parser's output.</p>
(e.g. the <a href=#websrt-parser>WebSRT parser</a> if the <a href=#content-type title=Content-Type>Content Type metadata</a> is is
<code><a href=#text/srt>text/srt</a></code>) as it is received, with the <a href=#timed-track-list-of-cues>timed
track list of cues</a> being used for that parser's output. If
the <code><a href=#the-track-element>track</a></code> element has a <code title=attr-track-charset><a href=#attr-track-charset>charset</a></code> attribute that specifies
a supported character encoding, then that encoding must be given
to the parser as a character encoding override. Otherwise the
parser must use its default character encoding behavior.</p>

<p>If the <a href=#fetch title=fetch>fetching algorithm</a> fails for
any reason (network error, the server returns an error code, a
Expand Down Expand Up @@ -28321,13 +28336,14 @@ <h6 id=syntax-0><span class=secno>4.8.10.11.1 </span>Syntax</h6>

<h6 id=parsing-0><span class=secno>4.8.10.11.2 </span>Parsing</h6>

<p>A <dfn id=websrt-parser>WebSRT parser</dfn>, given an input byte stream and a
<p>A <dfn id=websrt-parser>WebSRT parser</dfn>, given an input byte stream, a
<a href=#timed-track-list-of-cues>timed track list of cues</a> <var title="">output</var>,
must convert the bytes into a string of Unicode characters by
interpreting them as UTF-8, and then must parse the resulting string
according to the <a href=#websrt-parser-algorithm>WebSRT parser algorithm</a> below. This
results in <a href=#timed-track-cue title="timed track cue">timed track cues</a>
being added to <var title="">output</var>. <a href=#refsRFC3629>[RFC3629]</a></p>
and optionally a character encoding override <var title="">encoding</var>, must convert the bytes into a string of
Unicode characters by interpreting them as the given <var title="">encoding</var>, or UTF-8 if <var title="">encoding</var> is
not provided, and then must parse the resulting string according to
the <a href=#websrt-parser-algorithm>WebSRT parser algorithm</a> below. This results in
<a href=#timed-track-cue title="timed track cue">timed track cues</a> being added to
<var title="">output</var>. <a href=#refsRFC3629>[RFC3629]</a></p>

<p>A <a href=#websrt-parser>WebSRT parser</a>, specifically its conversion and
parsing steps, is typically run asynchronously, with the input byte
Expand All @@ -28339,10 +28355,11 @@ <h6 id=parsing-0><span class=secno>4.8.10.11.2 </span>Parsing</h6>

<ul class=brief><li><code><a href=#text/srt>text/srt</a></code></li>
</ul><!--<p class="note">Not all of these MIME types are valid registered
types.</p>--><p>When converting the bytes into Unicode characters, bytes or
sequences of bytes that are not valid UTF-8 sequences must be
interpreted as a U+FFFD REPLACEMENT CHARACTER, and all U+0000 NULL
characters must be replaced by U+FFFD REPLACEMENT CHARACTERs.</p>
types.</p>--><p>When converting the bytes into Unicode characters, if the
encoding used is UTF-8, bytes or sequences of bytes that are not
valid UTF-8 sequences must be interpreted as a U+FFFD REPLACEMENT
CHARACTER, and all U+0000 NULL characters must be replaced by U+FFFD
REPLACEMENT CHARACTERs.</p>

<p>The <dfn id=websrt-parser-algorithm>WebSRT parser algorithm</dfn> is as follows:</p>

Expand Down Expand Up @@ -89207,7 +89224,7 @@ <h3 id=text/srt><span class=secno>16.6 </span><dfn><code>text/srt</code></dfn></
<dt>Optional parameters:</dt>
<dd>No parameters</dd>
<dt>Encoding considerations:</dt>
<dd>Always UTF-8.</dd>
<dd>Must always be UTF-8.</dd>
<dt>Security considerations:</dt>
<dd>
<p>Timed track files themselves pose no immediate risk unless
Expand All @@ -89220,8 +89237,9 @@ <h3 id=text/srt><span class=secno>16.6 </span><dfn><code>text/srt</code></dfn></
</dd>
<dt>Interoperability considerations:</dt>
<dd>
Rules for processing both conforming and non-conforming content
are defined in this specification.
<p>Rules for processing both conforming and non-conforming content
are defined in this specification.</p>
<p>Some legacy files violate the requirement to use UTF-8.</p>
</dd>
<dt>Published specification:</dt>
<dd>
Expand Down
62 changes: 40 additions & 22 deletions index
Expand Up @@ -24040,16 +24040,18 @@ interface <dfn id=htmlaudioelement>HTMLAudioElement</dfn> : <a href=#htmlmediael
<dt>Content attributes:</dt>
<dd><a href=#global-attributes>Global attributes</a></dd>
<dd><code title=attr-track-kind><a href=#attr-track-kind>kind</a></code></dd>
<dd><code title=attr-track-label><a href=#attr-track-label>label</a></code></dd>
<dd><code title=attr-track-src><a href=#attr-track-src>src</a></code></dd>
<dd><code title=attr-track-charset><a href=#attr-track-charset>charset</a></code></dd>
<dd><code title=attr-track-srclang><a href=#attr-track-srclang>srclang</a></code></dd>
<dd><code title=attr-track-label><a href=#attr-track-label>label</a></code></dd>
<dt>DOM interface:</dt>
<dd>
<pre class=idl>interface <dfn id=htmltrackelement>HTMLTrackElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
attribute DOMString <a href=#dom-track-kind title=dom-track-kind>kind</a>;
attribute DOMString <a href=#dom-track-label title=dom-track-label>label</a>;
attribute DOMString <a href=#dom-track-src title=dom-track-src>src</a>;
attribute DOMString <a href=#dom-track-charset title=dom-track-charset>charset</a>;
attribute DOMString <a href=#dom-track-srclang title=dom-track-srclang>srclang</a>;
attribute DOMString <a href=#dom-track-label title=dom-track-label>label</a>;

readonly attribute <a href=#timedtrack>TimedTrack</a> <a href=#dom-track-track title=dom-track-track>track</a>;
};</pre>
Expand Down Expand Up @@ -24106,6 +24108,14 @@ interface <dfn id=htmlaudioelement>HTMLAudioElement</dfn> : <a href=#htmlmediael
<a href=#websrt>WebSRT</a> file must be a <a href=#websrt-file-using-cue-text>WebSRT file using cue
text</a>.</p>

<p>If the elements's <a href=#track-url>track URL</a> identifies a
<a href=#websrt>WebSRT</a> resource, then the <dfn id=attr-track-charset title=attr-track-charset><code>charset</code></dfn> attribute may
be specified. If the attribute is set, its value must be a valid
character encoding name, must be an <a href=#ascii-case-insensitive>ASCII
case-insensitive</a> match for the <a href=#preferred-mime-name>preferred MIME
name</a> for that encoding, and must match the character encoding
of the <a href=#websrt>WebSRT</a> file. <a href=#refsIANACHARSET>[IANACHARSET]</a></p>

<p>The <dfn id=attr-track-srclang title=attr-track-srclang><code>srclang</code></dfn>
attribute gives the language of the timed track data. The value must
be a valid BCP 47 language tag. This attribute must be present if
Expand Down Expand Up @@ -24160,11 +24170,11 @@ interface <dfn id=htmlaudioelement>HTMLAudioElement</dfn> : <a href=#htmlmediael
<a href=#timed-track>timed track</a>'s corresponding <code><a href=#timedtrack>TimedTrack</a></code>
object.</p>

<p>The <dfn id=dom-track-label title=dom-track-label><code>label</code></dfn>, <dfn id=dom-track-src title=dom-track-src><code>src</code></dfn>, and <dfn id=dom-track-srclang title=dom-track-srclang><code>srclang</code></dfn> IDL attributes
must <a href=#reflect>reflect</a> the respective content attributes of the
same name. The <dfn id=dom-track-kind title=dom-track-kind><code>kind</code></dfn>
IDL attributemust <a href=#reflect>reflect</a> the content attribute of the
same name, <a href=#limited-to-only-known-values>limited to only known values</a>.</p>
<p>The <dfn id=dom-track-src title=dom-track-src><code>src</code></dfn>, <dfn id=dom-track-charset title=dom-track-charset><code>charset</code></dfn>, <dfn id=dom-track-srclang title=dom-track-srclang><code>srclang</code></dfn>, and <dfn id=dom-track-label title=dom-track-label><code>label</code></dfn> IDL attributes must
<a href=#reflect>reflect</a> the respective content attributes of the same
name. The <dfn id=dom-track-kind title=dom-track-kind><code>kind</code></dfn> IDL
attributemust <a href=#reflect>reflect</a> the content attribute of the same
name, <a href=#limited-to-only-known-values>limited to only known values</a>.</p>

</div>

Expand Down Expand Up @@ -27153,8 +27163,13 @@ interface <dfn id=htmlaudioelement>HTMLAudioElement</dfn> : <a href=#htmlmediael
unsupported (this causes the load to fail, as described below). If
a type is obtained, and represents a supported timed track format,
then the resource's data must be passed to the appropriate parser
as it is received, with the <a href=#timed-track-list-of-cues>timed track list of cues</a>
being used for that parser's output.</p>
(e.g. the <a href=#websrt-parser>WebSRT parser</a> if the <a href=#content-type title=Content-Type>Content Type metadata</a> is is
<code><a href=#text/srt>text/srt</a></code>) as it is received, with the <a href=#timed-track-list-of-cues>timed
track list of cues</a> being used for that parser's output. If
the <code><a href=#the-track-element>track</a></code> element has a <code title=attr-track-charset><a href=#attr-track-charset>charset</a></code> attribute that specifies
a supported character encoding, then that encoding must be given
to the parser as a character encoding override. Otherwise the
parser must use its default character encoding behavior.</p>

<p>If the <a href=#fetch title=fetch>fetching algorithm</a> fails for
any reason (network error, the server returns an error code, a
Expand Down Expand Up @@ -28301,13 +28316,14 @@ interface <dfn id=timedtrackcue>TimedTrackCue</dfn> {

<h6 id=parsing-0><span class=secno>4.8.10.11.2 </span>Parsing</h6>

<p>A <dfn id=websrt-parser>WebSRT parser</dfn>, given an input byte stream and a
<p>A <dfn id=websrt-parser>WebSRT parser</dfn>, given an input byte stream, a
<a href=#timed-track-list-of-cues>timed track list of cues</a> <var title="">output</var>,
must convert the bytes into a string of Unicode characters by
interpreting them as UTF-8, and then must parse the resulting string
according to the <a href=#websrt-parser-algorithm>WebSRT parser algorithm</a> below. This
results in <a href=#timed-track-cue title="timed track cue">timed track cues</a>
being added to <var title="">output</var>. <a href=#refsRFC3629>[RFC3629]</a></p>
and optionally a character encoding override <var title="">encoding</var>, must convert the bytes into a string of
Unicode characters by interpreting them as the given <var title="">encoding</var>, or UTF-8 if <var title="">encoding</var> is
not provided, and then must parse the resulting string according to
the <a href=#websrt-parser-algorithm>WebSRT parser algorithm</a> below. This results in
<a href=#timed-track-cue title="timed track cue">timed track cues</a> being added to
<var title="">output</var>. <a href=#refsRFC3629>[RFC3629]</a></p>

<p>A <a href=#websrt-parser>WebSRT parser</a>, specifically its conversion and
parsing steps, is typically run asynchronously, with the input byte
Expand All @@ -28319,10 +28335,11 @@ interface <dfn id=timedtrackcue>TimedTrackCue</dfn> {

<ul class=brief><li><code><a href=#text/srt>text/srt</a></code></li>
</ul><!--<p class="note">Not all of these MIME types are valid registered
types.</p>--><p>When converting the bytes into Unicode characters, bytes or
sequences of bytes that are not valid UTF-8 sequences must be
interpreted as a U+FFFD REPLACEMENT CHARACTER, and all U+0000 NULL
characters must be replaced by U+FFFD REPLACEMENT CHARACTERs.</p>
types.</p>--><p>When converting the bytes into Unicode characters, if the
encoding used is UTF-8, bytes or sequences of bytes that are not
valid UTF-8 sequences must be interpreted as a U+FFFD REPLACEMENT
CHARACTER, and all U+0000 NULL characters must be replaced by U+FFFD
REPLACEMENT CHARACTERs.</p>

<p>The <dfn id=websrt-parser-algorithm>WebSRT parser algorithm</dfn> is as follows:</p>

Expand Down Expand Up @@ -85122,7 +85139,7 @@ interface <a href=#htmldocument>HTMLDocument</a> {
<dt>Optional parameters:</dt>
<dd>No parameters</dd>
<dt>Encoding considerations:</dt>
<dd>Always UTF-8.</dd>
<dd>Must always be UTF-8.</dd>
<dt>Security considerations:</dt>
<dd>
<p>Timed track files themselves pose no immediate risk unless
Expand All @@ -85135,8 +85152,9 @@ interface <a href=#htmldocument>HTMLDocument</a> {
</dd>
<dt>Interoperability considerations:</dt>
<dd>
Rules for processing both conforming and non-conforming content
are defined in this specification.
<p>Rules for processing both conforming and non-conforming content
are defined in this specification.</p>
<p>Some legacy files violate the requirement to use UTF-8.</p>
</dd>
<dt>Published specification:</dt>
<dd>
Expand Down

0 comments on commit fa7d599

Please sign in to comment.