isaacs / minipass

A stream implementation that does more by doing less

Home Page:https://twitter.com/izs/status/1174465160737509376

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

UTF-16 character in index.js breaks programs using UTF-8

JortvD opened this issue · comments

In commit c12273b the character ॐ was introduced as parameter for the set objectMode function. While in most cases this character is accepted as identifier name, tested for v8, programs like webpack like to default to utf-8 instead of utf-16. In utf-16 ॐ is a single character, 0x0950, but in utf-8 it is split up into multiple characters, 0xE0 0xA5 0x90 or à¥�, which of course isn't allowed as identifier name, resulting in a SyntaxError.
I fixed it in my case by forcing webpack to use utf-16, but I take it using the character ॐ isn't intended.

🤣 ॐ

It's a cute nerdy pun, but yeah I was so surprised to see Sanskrit in JavaScript source and apparently so was Chrome.
Setting <meta charset="utf-8"> did make the file parse correctly in Chrome, with that same byte sequence 0xE0 0xA5 0x90, so seems like it is valid UTF-8 after all?