Skip to content

Fix for SET NAMES utf8 causing an unknown encoding error #3551

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

Merged
merged 1 commit into from
Apr 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/constants/encoding_charset.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,5 @@ module.exports = {
cp932: 95,
eucjpms: 97,
gb18030: 248,
utf8mb3: 192,
};
8 changes: 7 additions & 1 deletion lib/packets/resultset_header.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,13 @@ class ResultSetHeader {
stateChanges.systemVariables[key] = val;
if (key === 'character_set_client') {
const charsetNumber = EncodingToCharset[val];
connection.config.charsetNumber = charsetNumber;
// TODO - better api for driver users to handle unknown encodings?
// maybe custom coverter in the config?
// For now just ignore character_set_client command if there is
// no known mapping from reported encoding to a charset code
if (typeof charsetNumber !== 'undefined') {
connection.config.charsetNumber = charsetNumber;
}
}
} else if (type === sessionInfoTypes.SCHEMA) {
key = packet.readLengthCodedString(encoding);
Expand Down
Loading