Unable to insert data with utf8mb4

Discussion of open issues, suggestions and bugs regarding database management and administration tools for MySQL
Post Reply
michabbb
Posts: 217
Joined: Mon 21 Nov 2011 02:35
Location: DE
Contact:

Unable to insert data with utf8mb4

Post by michabbb » Thu 19 Nov 2020 15:06

hi alex,

i have a database, tables and columns with utf8mb4.
at the connection settings i can choose the encoding utf8mb4 but the naming confuses me:

Code: Select all

utf8mb4 -> Unicode (UTF-8)
because for me it looks like, dbforge IS NOT using utf8mb4, it´s using utf8.

when i try this insert:

Code: Select all

INSERT INTO mytable
(
 title
)
VALUES
(
  'funny title with utf8 unicode char 🔧'
);
i get this error:

Code: Select all

Incorrect string value: '\xF0\x9F\x94\xA7' for column 'title' at row 1
and I wouldn't see this error if dbforge would use utf8mb4 as charset.
I tested this with PHP, I get the same error if u try this insert (via mysqli) with utf8.
when I explicitly set the charset to utf8mb4, no error, the insert works.

so.... how can I tell dbforge to use utf8mb4 instead of utf8 ???

thanks,
micha

dzhanhira
Devart Team
Posts: 239
Joined: Mon 26 Oct 2020 13:49

Re: Unable to insert data with utf8mb4

Post by dzhanhira » Fri 20 Nov 2020 09:05

Could you please perform the following requests and send us:

1. SHOW CREATE TABLE <table_name>;
2. SHOW SESSION VARIABLES LIKE 'collation_connection';

Also, please clarify which build of server do you use.

michabbb
Posts: 217
Joined: Mon 21 Nov 2011 02:35
Location: DE
Contact:

Re: Unable to insert data with utf8mb4

Post by michabbb » Fri 20 Nov 2020 13:57

hi there,

this morning, i switched on my pc (from hibernate)... went into dbforge, the program was still open, the tab was still open,
made the same test again: and guess: no error. holy f***....

i have absolutely no clue what has changed because i didn´t change anything!
the only thing i can guess is, that even i changed the connection settings several times to test the charset encoding
of my connection (in dbforge)... it had no effect yesterday, even i disconnected and connected several times in a row.
so maybe, the connection yesterday never was totally closed, no idea.....

however.... this problem either has never existed or... whatever ;-)

Image

Post Reply