WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED WONTFIX
101278
Encoding API
https://bugs.webkit.org/show_bug.cgi?id=101278
Summary
Encoding API
Joshua Bell
Reported
2012-11-05 16:47:29 PST
Encoding API
Attachments
Patch
(55.60 KB, patch)
2012-11-05 16:48 PST
,
Joshua Bell
no flags
Details
Formatted Diff
Diff
Patch
(56.13 KB, patch)
2012-11-08 15:12 PST
,
Joshua Bell
no flags
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Joshua Bell
Comment 1
2012-11-05 16:48:02 PST
Created
attachment 172437
[details]
Patch
Joshua Bell
Comment 2
2012-11-05 16:51:39 PST
Not a full implementation yet (streaming, labels/names, BOM handling, etc) and no tests. But the basics work: d = new TextDecoder('utf-16'); d.decode(new Uint8Array([65, 00, 66, 00, 67, 00])); // => "ABC" e = new TextEncoder('utf-8'); e.encode('abc'); // => [97, 98, 99] (I also went crazy with adding the files to every build system I could find as that appeared to be the precedent - except the xcodeproj since I didn't have a mac handy.)
Kenneth Russell
Comment 3
2012-11-05 18:02:08 PST
Comment on
attachment 172437
[details]
Patch Nice start! Let's see what the EWS bots say.
Adam Barth
Comment 4
2012-11-05 23:17:47 PST
Is this an implementation of
http://encoding.spec.whatwg.org/
?
Build Bot
Comment 5
2012-11-06 02:09:39 PST
Comment on
attachment 172437
[details]
Patch
Attachment 172437
[details]
did not pass mac-ews (mac): Output:
http://queues.webkit.org/results/14733698
New failing tests: fast/regions/floats-basic-in-variable-width-regions.html fast/dynamic/subtree-parent-static-y.html fast/regions/render-region-renderer.html fast/spatial-navigation/snav-unit-overflow-and-scroll-in-direction.html platform/mac/fast/loader/file-url-mimetypes-2.html fast/regions/float-pushed-width-change.html fast/images/repaint-subrect-grid.html platform/mac/editing/spelling/removing-underline-after-accepting-autocorrection-using-punctuation.html
Joshua Bell
Comment 6
2012-11-06 08:45:22 PST
(In reply to
comment #4
)
> Is this an implementation of
http://encoding.spec.whatwg.org/
?
That's the goal, yes.
Joshua Bell
Comment 7
2012-11-08 15:12:44 PST
Created
attachment 173130
[details]
Patch
Joshua Bell
Comment 8
2012-11-08 15:22:55 PST
NOTE: Still not ready for a review. Now uses TextCodec which is in theory the right WebCore API for encode/decode calls. Streaming for decode is hooked up, but notably TextCodecUTF16 actually ignored the |flush| flag and never actually flushes.
Alexey Proskuryakov
Comment 9
2012-11-08 15:49:04 PST
What is the use case for this API? My concern is that there are many little knobs in codecs (what to do with invalid input, how to encode things that don't fit into target encoding, whether to strip BOM etc.) All use cases combined seem fairly marginal, and each of them needs a different behavior. Will we end up with a ton of options that will need to be agreed upon and supported in all browsers?
Joshua Bell
Comment 10
2012-11-08 15:54:43 PST
(In reply to
comment #9
)
> What is the use case for this API?
Encoding/decoding text from Typed Arrays, e.g. parsing legacy file formats, packing binary data for upload, etc.
> My concern is that there are many little knobs in codecs (what to do with invalid input, how to encode things that don't fit into target encoding, whether to strip BOM etc.)
Spec is here:
http://encoding.spec.whatwg.org/#api
- there's been quite a bit of discussion on WHATWG, you can check the archives. Some of the history of open issues is also captured at
http://wiki.whatwg.org/wiki/StringEncoding
> All use cases combined seem fairly marginal, and each of them needs a different behavior. Will we end up with a ton of options that will need to be agreed upon and supported in all browsers?
The goal has been supporting the use case while matching the existing encoding/decoding behavior of the Web platform, which is what the rest of that spec details - avoiding as many knobs as possible for legacy encodings unless required by existing content.
Alexey Proskuryakov
Comment 11
2012-11-08 16:11:14 PST
> The goal has been supporting the use case while matching the existing encoding/decoding behavior of the Web platform
All the knobs that I mentioned are needed to implement various parts of the Web platforms. In fact, a new knob is being added right now in
bug 101569
. I did not think about legacy encodings, just about different modes of operation (e.g. encoding for form submission, encoding for XMLHttpRequest posting, encoding for WebSocket posting, encoding for URL).
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug