New issue
Advanced search Search tips

Issue 920107 link

Starred by 6 users

Issue metadata

Status: Started
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Android , Windows , Chrome , Mac , Fuchsia
Pri: 2
Type: Feature



Sign in to add a comment

Implement TextEncoder's encodeInto()

Project Member Reported by annevank...@gmail.com, Jan 9

Issue description

This API allows for encoding a string into UTF-8 bytes using a preexisting target buffer.

See https://github.com/whatwg/encoding/pull/166 for the standard change and https://github.com/web-platform-tests/wpt/pull/14505 for tests.
 
Cc: hirosh...@chromium.org jsb...@chromium.org yhirano@chromium.org
Status: Untriaged (was: Unconfirmed)
This should be pretty straightforward. Any volunteers?

I think I would implement the underlying functionality only in WTF::TextCodecUTF8 rather than add a virtual method to WTF::TextCodec which would only be implemented for UTF8 anyway.
Cc: domfarolino@gmail.com
Labels: -OS-iOS
Not iOS (which does not use Blink)
Cc: ricea@chromium.org
Labels: Hotlist-GoodFirstBug
Tagging with GFB to hopefully catch some attention. 

This will require an "Intent to Implement and Ship"; happy to help with that if an external contributor picks this up.
Labels: -Pri-3 Pri-2
Status: Available (was: Untriaged)
Interested in taking it, but can't yet guarantee an timeline. Will keep this thread updated though.

Comment 7 by domfarolino@gmail.com, Jan 20 (3 days ago)

Cc: -domfarolino@gmail.com
Owner: domfarolino@gmail.com
Status: Started (was: Available)

Comment 8 by domfarolino@gmail.com, Today (12 hours ago)

Following ricea@'s advice, my thoughts were to make a method similar to WTF::TextCodecUTF8::Encode that takes in a "capacity" in addition to the "length". Then we  can make something like WTF::TextCodecUTF8::EncodeCommon that takes in the capacity, and calls U8_APPEND with it, instead of U8_APPEND_UNSAFE. However, this requires a TextCodecUTF8::Encode method with a new signature, and thus a change to WTF::TextCodec to support this IIUC.

Thoughts on getting around this to avoid touching all of the TextCodec subclasses?

Comment 9 by jsb...@chromium.org, Today (11 hours ago)

I think it would be acceptable to have virtual WTF::TextCodec::EncodeInto() { NOTREACHED(); }, overridden only in TextCodecUTF8. And then WTF::TextEncoding::EncodeInto() with a sufficient warning that only UTF8 supports it. 



 

Sign in to add a comment