adamhaile / surplus

High performance JSX web views for S.js applications
639 stars 26 forks source link

Emoijs aren't encoded correctly #79

Closed Qix- closed 5 years ago

Qix- commented 5 years ago

It appears as though emojis (and I would imagine other higher Unicode characters) are not being encoded correctly.

<div>
    🍔
</div>

appears to get encoded down to:

__.textContent = "🍔";
derekhawker commented 5 years ago

Could this be related to how emjois are treated in javascript strings? https://github.com/orling/grapheme-splitter.

I haven't noticed a problem when working with Surplus, though. I tried using Firefox's dev tools to look at the source for a JS file that used your emoji snippet and it didn't notice anything odd about the encoding. It displayed without any trouble in Firefox, too.

emoji-src

adamhaile commented 5 years ago

Surplus is just using Javascript's standard Unicode strings, so there shouldn't be an issue internally, but who knows?

Your example appears to work running in a browser: Surplus issue #79

What's your build setup? Webpack with surplus-loader or something else? I wonder if your text encoding is being messed up somewhere.

Qix- commented 5 years ago

Rollup in this case. I can see if it's another plugin doing the mangling, I'm not near a computer at the moment.

Qix- commented 5 years ago

Going to assume it's rollup again - Parcel has no problem with this.