-
-
Notifications
You must be signed in to change notification settings - Fork 622
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
Error: Encoding not recognized: 'undefined' #1398
Comments
Our last post : #1333 It turned out to be necessary to add "utf8mb3: 45". I don’t know if this should be added to the main branch ... P.S. MySQL server version: 8.0.26-0ubuntu0.20.04.3 |
Hi @egorovd - can you post a small self contained example to reproduce that? |
ok, so if I understand correctly you passed |
I encountered this today and It turned out to be necessary to add "utf8mb3: 45". mysql> show variables like "character_set_%"; Can this support be generally added by default? |
@snxraven can you try to run https://github.com/sidorares/node-mysql2/blob/master/tools/generate-charset-mapping.js on your database? Yes, likely we want to add node-mysql2/lib/constants/encoding_charset.js Lines 37 to 38 in 5e59e70
|
This is the requested output @sidorares |
could you filter the first array to only include items where |
@sidorares This output may be more useful |
hm, can't see a charset with https://dev.mysql.com/doc/refman/8.0/en/charset-unicode-utf8mb3.html need to confirm which iconv encoding should we map |
Yeah, thats odd, when sorting just for "utf8mb3" nothing does come up. |
I've encountered this issue with a MySQL server that is configured to use My workaround is to add an entry Note it seems .NET official client made a change to fix a similar issue: Bug #33556024 - Connector/Net doesn't recognize utf8mb3 · mysql/mysql-connector-net@16ad749, implying clients are expected to support |
internally we map mysql utf8 to iconv's If thats a correct mapping, extra line
After that regenerate https://github.com/sidorares/node-mysql2/blob/master/lib/constants/charset_encodings.js |
I guess |
It seems system variable await conn.execute("SET @@character_set_client = 'utf8mb3'")
await conn.execute("SELECT 'something'") // throws Self-contained version is: repro-mysql-encoding.zip
|
In case that someone runs into the same problem and I can save his time with this post... I requested my database from our companies Database team and gave them an sql file to import for the database structure (In our company you are not able to be database admin. Its all done by a special database team). In the sql file I explicitly set all character sets to utf8mb4. But when they created the database, I run in the same error: 2024-06-12T08:46:56.989Z error: Encoding not recognized: 'undefined' (searched as: 'undefined') It took me hours to find out, that they have created my database with utf8mb4 but they created the information_schema in utf8mb3. (Who will think of that?) Adding utf8mb3 in the encoding file worked. But of course I have requested DB team to change charset of information_schema to utf8mb4. Is there any problem adding utf8mb3 to the encoding file per default for you lib? |
In the short-term (prior to fixing our database's default charset) we've worked around this by monkey patching the |
Hello.
Until today, everything worked fine, until the MySQL was updated from version 5 to version 8.
And I get this error after any write (INSERT or UPDATE).
Who has not encountered such a problem?
How the problem can be diagnosed.
Maybe something is missing in the settings on the server?
Thank you.
The text was updated successfully, but these errors were encountered: