This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 27219 - Small fixes for TextEncoder.encode() method.
Summary: Small fixes for TextEncoder.encode() method.
Status: RESOLVED FIXED
Alias: None
Product: WHATWG
Classification: Unclassified
Component: Encoding (show other bugs)
Version: unspecified
Hardware: PC Windows NT
: P2 normal
Target Milestone: Unsorted
Assignee: Anne
QA Contact: sideshowbarker+encodingspec
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-11-01 15:28 UTC by Arkadiusz Michalski (Spirit)
Modified: 2014-11-01 16:36 UTC (History)
2 users (show)

See Also:


Attachments

Description Arkadiusz Michalski (Spirit) 2014-11-01 15:28:19 UTC
Hi, I found this small inaccuracy:

https://encoding.spec.whatwg.org/#dom-textencoder-encode

"The encode(input, options) method, when invoked..." << /options/ not exist for this method, should be just "encode(input)". In algorithm I don't see using /options/ at least once.

For the same case, in green box, this text can be delete:

"If options's stream is set to true, the method can be invoked multiple times to process a fragmented stream." << this is funcionality of TextDecoder, not TextEncoder.

But in the other site encode() should support streaming like decode()? 

I test this in Firefox an Chrome:

<script type = "text/javascript">

	alert(new TextEncoder().encode("", 2,2,2,2));

</script>

and get the result:

- Chrome works fine, ignores additional arguments
- Firefox throw "TypeError: Argument 2 of TextEncoder.encode can't be converted to a dictionary". Looks like Firefox take attention to the second argument but why? Its bug?
Comment 1 Anne 2014-11-01 16:21:36 UTC
TextEncoder used to support streaming, but that was made obsolete when we switched from DOMString to USVString. There's no encoding for which you need multiple scalar values to get a byte sequence.

Firefox might still have the old binding.