Skip to content

Conversation

@prydt
Copy link

@prydt prydt commented Dec 31, 2025

Current implementation of Buffer.toString does not match Node.js behavior when using undefined as encoding.

Folks have run into this here: mariadb-corporation/mariadb-connector-nodejs#322 (comment)

@prydt prydt requested review from a team as code owners December 31, 2025 20:41
@github-actions
Copy link

github-actions bot commented Dec 31, 2025

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@prydt
Copy link
Author

prydt commented Dec 31, 2025

I have read the CLA Document and I hereby sign the CLA

github-actions bot added a commit that referenced this pull request Dec 31, 2025
@anonrig
Copy link
Member

anonrig commented Dec 31, 2025

Can you add a test?

@prydt
Copy link
Author

prydt commented Dec 31, 2025

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants