ashtuchkin / iconv-lite

Convert character encodings in pure javascript.
MIT License
3.07k stars 282 forks source link

ensure support for Uint8Array #246

Closed gyzerok closed 4 years ago

gyzerok commented 4 years ago

I went ahead and created this PR for https://github.com/microsoft/vscode/issues/79275#issuecomment-647224220 so you don't need to spend your time if you agree with the idea.

No pressure though, feel free to close it if you disagree 😄

ashtuchkin commented 4 years ago

That's great work Fedor! I'm a bit busy currently, so expect maybe 1-2 days delays before I can look deeper. At the high level I like this approach.

Alexander Shtuchkin

On Mon, Jun 22, 2020 at 12:56 AM Fedor Nezhivoi notifications@github.com wrote:

@gyzerok commented on this pull request.

In test/webpack/basic-test.js https://github.com/ashtuchkin/iconv-lite/pull/246#discussion_r443316876:

@@ -36,6 +36,29 @@ describe("iconv-lite", function() {

     var str = iconv.decode(buf, "utf8");

     assert.equal(str, "💩");

 });

+

  • it("supports passing Uint8Array to decode for all encodings", function() {

  • iconv.encode('', 'utf8'); // Load all encodings.

  • const encodings = Object.keys(iconv.encodings)

  • encodings.forEach(function(encoding) {

  • if (['base64', 'hex', '_internal', '0'].indexOf(encoding) >= 0) {

Excluded temporarily base64 and hex since they don't seem to work even with buffers: #247 https://github.com/ashtuchkin/iconv-lite/issues/247

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ashtuchkin/iconv-lite/pull/246#pullrequestreview-434602945, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEZKHKONMGN6DPPZDM7CZDRX3QA3ANCNFSM4OEF3A4Q .

gyzerok commented 4 years ago

@ashtuchkin thank you for the review! All the changes applied. Would you be able to publish it as a new version, so I can continue with vscode? :)

ashtuchkin commented 4 years ago

Yep, will publish in a couple mins

ashtuchkin commented 4 years ago

ok, it's published as 0.6.1