-
Notifications
You must be signed in to change notification settings - Fork 502
Fix Buffer.toString encoding to match Node.js #5807
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: main
Are you sure you want to change the base?
Conversation
|
All contributors have signed the CLA ✍️ ✅ |
|
I have read the CLA Document and I hereby sign the CLA |
|
Can you add a test? |
Added a test. My initial thought was to reuse normalizeEncoding but found that Buffer.toString should fail on null while streams which were using the same encoding function accept null as well (readable_setencoding_null), so I went back to using getEncodingOps but adding a special case for undefined. |
|
We don't allow fix ups. Can you squash all your commits? |
Done. Thank you both! |
This comment was marked as off-topic.
This comment was marked as off-topic.
|
Eslint tests are failing. |
When looking at the lint failures, it looks like it has to do with lines that I didn't touch within getEncodingOps. Should I change this other code to pass the lint or should I add enable / disable eslint comments? This function already disables certain lints. |
Head branch was pushed to by a user without write access
|
I've added a fix for the lint, and it passes tests locally. Just put in a separate commit to make it easy to review since I'm not certain about why the code I'm modifying was written like this in the first place. Will squash if you are okay with this approach. |
|
Should be squashed and ready. |
Current implementation of Buffer.toString does not match Node.js behavior when using
undefinedas encoding.Folks have run into this here: mariadb-corporation/mariadb-connector-nodejs#322 (comment)