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

Conversation

sidorares
Copy link
Owner

query("SET NAMES utf8;"); command returns instruction from the server "please use utf8mb3 client character set"

2 issues we had:

  • we did not have utf8mb3 in the EncodingToCharset map
  • in case of encoding name is not recognised we set undefined to connection config charsetNumber, and next command fails

Fixes #3338

@sidorares sidorares requested a review from Copilot April 26, 2025 06:44
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes an issue whereby the "SET NAMES utf8;" command resulted in an unknown encoding error by addressing two issues: ensuring that the encoding "utf8mb3" is mapped in the EncodingToCharset map and preventing a failure when the encoding is not recognized.

  • Updated lib/packets/resultset_header.js to only update connection.config.charsetNumber when a valid mapping exists.
  • Added the "utf8mb3" mapping with charset code 192 in lib/constants/encoding_charset.js.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
lib/packets/resultset_header.js Conditional update to avoid setting an undefined charsetNumber in the config.
lib/constants/encoding_charset.js Added mapping for "utf8mb3" to fix the unknown encoding error.

Copy link

codecov bot commented Apr 26, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.08%. Comparing base (47905ae) to head (e384840).
Report is 8 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #3551   +/-   ##
=======================================
  Coverage   89.08%   89.08%           
=======================================
  Files          86       86           
  Lines       13531    13538    +7     
  Branches     1569     1569           
=======================================
+ Hits        12054    12061    +7     
  Misses       1477     1477           
Flag Coverage Δ
compression-0 89.08% <100.00%> (+<0.01%) ⬆️
compression-1 89.08% <100.00%> (+<0.01%) ⬆️
static-parser-0 86.66% <100.00%> (+<0.01%) ⬆️
static-parser-1 87.45% <100.00%> (+<0.01%) ⬆️
tls-0 88.50% <100.00%> (+<0.01%) ⬆️
tls-1 88.86% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@sidorares sidorares merged commit 0617813 into master Apr 26, 2025
100 checks passed
@wellwelwel
Copy link
Collaborator

@sidorares, we can perform manually an empty commit to force the release-please in a specific version, for example, by pushing directly to master:

git commit --allow-empty -m "chore: release 3.14.1" -m "Release-As: 3.14.1"

🔗 https://github.com/googleapis/release-please?tab=readme-ov-file#how-do-i-change-the-version-number

Note

This fix is already available in canary version.

@sidorares
Copy link
Owner Author

Thanks @wellwelwel ! done - #3552

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.

Error: Encoding not recognized: 'undefined'
2 participants