-
Notifications
You must be signed in to change notification settings - Fork 3
Fix Unicode Encode/Decode Process #9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Codecov Report
@@ Coverage Diff @@
## master #9 +/- ##
========================================
+ Coverage 92.85% 100% +7.14%
========================================
Files 3 1 -2
Lines 42 14 -28
========================================
- Hits 39 14 -25
+ Misses 3 0 -3
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, I'd like to figure out how we can make this happen, but before I merge this I'd want to determine why we have passing tests for unicode encode/decode, but it is still not working in your case.
This solution, while nice and clean, adds two additional fairly large dependencies that will be pulled down on the client side, and have a performance impact on all sites that implement this library. The current solution adds minimal code and no extra dependencies, and so if the tests are passing and it's working, I'd prefer to avoid the extra weight if possible.
I know this is a super late review, just was revisiting this and I do want to make sure it has been resolved at some point.
} | ||
module.exports.encode = encode | ||
const utf8 = require('utf8') | ||
const Buffer = require('buffer/').Buffer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo here, no idea how tests would be passing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm guessing you're referring to the /
in the require? this forces node to look inside node_modules
instead of using buffer
from the internal api
The current tests are rather bare and should have included a larger set of Unicode characters from Unicode 6.0.0 standard. The provided solution here does work and is used in a production setting. I'm unable to allocate time to this currently, however, if I wind-up with free time in the future I can revisit this and add more tests. |
NOTE: the
package.json
edits were made by yarn/npm installationSummary
This pull request normalizes encodings between node and the browser. By doing so we eliminate any malformed data and introduce a stable
utf8
encoding/decoding library which improves stability between both environments.Updates