Skip to content
Permalink
Browse files

[giow] (0) Allow authors to override WebSRT's encoding using <track c…

…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 fa7d599ed3f1880aca12681983c5339727c08c88
Showing with 129 additions and 68 deletions.
  1. +40 −22 complete.html
  2. +40 −22 index
  3. +49 −24 source
<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>
<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
<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>

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

<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

<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>

<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
</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>
62 index
<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>
<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
<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>

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

<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

<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>

<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
</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>

0 comments on commit fa7d599

Please sign in to comment.
You can’t perform that action at this time.