Page 1 of 1

Unable to insert data with utf8mb4

Posted: Thu 19 Nov 2020 15:06
by michabbb
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

Re: Unable to insert data with utf8mb4

Posted: Fri 20 Nov 2020 09:05
by dzhanhira
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.

Re: Unable to insert data with utf8mb4

Posted: Fri 20 Nov 2020 13:57
by michabbb
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