ERROR 1366: 1366: Incorrect string value - mysql

I get an error when trying to insert characters like čćšđž:
ERROR 1366: 1366: Incorrect string value: '\xC4\x87'
I've searched the internet and found out that this error may be caused if I try to insert character which needs more than 3 bytes, but as you can see in this error, my character takes only 2 bytes.
Collation is set to utf8_unicode_ci, mysql version is 5.6.27.
Can someone help with this?

Since \xC4\x87 seems to be the correct UTF-8 representation for U+0107 you are either not telling MySQL what encoding to use when you stablish the connection or you're reporting a wrong one.

Related

Incorrect string value: '\xC3' for column

I can't save some data in my mysql database.
SQLSTATE[HY000]: General error: 1366 Incorrect string value: '\xC3' for column 'title' at row 1
row title use the collation utf8mb4_unicode_ci.
What's wrong with it? How could I save my data?
PS: I try pretty much every solution give in stackoverflow. That why I create a new thread.
C3 may indicate a utf8 character being interpreted as latin1. Or it may indicate "double encoding".
SHOW VARIABLES LIKE 'char%';
See... utf8
The solution is probably to connect with utf8mb4, not with the default.
What version of MySQL are you using? What parameters does Doctrine use when connecting?
Am getting the same error while I try to upload (🗽<- this type [UTF8]). '1366. Incorrect string value: '\xF0\x9F\x98\x80' for column'
But am changing the data type to 'mediumblob' then its working fine.
check out the screenshot. Now the error solved

Uncaught exception 'PDOException' with message 'SQLSTATE[22007]: Invalid datetime format: 1366 Incorrect string value

This is the error I am getting.
PDOException: Uncaught exception 'PDOException' with message 'SQLSTATE[22007]: Invalid datetime format: 1366 Incorrect string value: '\xF0\x9F\x98\xB3' for column 'string' at row 1'
I know the problem here. The column table is using utf8. The utf8 encoding cannot store 4 byte characters so it errors. A way to get around this could be to use utf8mb4 instead.
My question instead is about the error message. We are using MariaDB. Why does it say "Invalid datetime format" in the error message? This is a text field. There is nothing to do with datetime in the query being run.
This "Invalid datetime format" comes up often for a variety of errors but seems unrelated to the actual source of the error.
Yes, I've seen this before.
I suppose it's a bug on the mariadb side, where all errors on the incorrect values are dubbed as "incorrect datetime value".
I see no harm here though beside a little confusion. Just keep in mind the issue and treat it as "incorrect text value"

MySQL UTF-8 issue with c caron (hatscheck) from Czech language

This problems origins from TYPO3, where I can't insert a c caron (č) in RTE while s caron (š) works. But soon I realised, that the problem also occurs, when I directly insert a c caron in phpMyAdmin.
Charset in DB and the table is both UTF8_unicode_ci, I also tried UTF8mb4_unicode_ci with no success.
Error: Warning: #1366 Incorrect string value: '\xC4\x8D \x0D\x0A' for column 'bodytext' at row 1
Thanks in advance!
PS: Similar problem with Ś Warning: #1366 Incorrect string value: '\xC5\x9A' for column 'bodytext' at row 1
Thanks for your comments! I've found the error: Databse was UTF-8, table was UTF-8 but the field was Latin-1... LOL! Changed to UTF-8 and now it works. Thanks for all your help!

Incorrect string value: '\xF0\X9F... and I use utf8mb4 got ? in mysql

the source character is "💰in check" which one of our app users added, and i can't figure out what it is actually.
i used way of this link ("Incorrect string value" when trying to insert UTF-8 into MySQL via JDBC?) to solve the problem when i insert special characters into mysql via jdbc.
but when sql exception ws gone, i find my characters inserted into mysql are like this "? in check"
can anybody help me slove this problem? thanks

Phpmyadmin - error for symbol °

I seem to have a weird problem with my Phpmyadmin database. When I use the symbol ° in my table subject it gives an error and won't insert, for my table message however this doesn't make a difference.
I tried it as a VARCHAR and as TEXT, but both give errors. The message field is a TEXT and doesn't give any errors.
I found this: http://fogbugz.stackexchange.com/questions/2156/how-do-i-fix-incorrect-string-value-x-errors-when-running-on-mysql
My outputs are: utf8_general_ci, latin1_swedish_ci, latin1_swedish_ci
Error:
DB Error #1366
INSERT INTO table SET created=NOW() ,ticketID=7403, subject='FW: Stackoverflow N� 456'
Incorrect string value: 'xB0 4100...' for column 'subject' at row 1
Change Collation of your table to utf8_general_ci
I was able to get it to work with a patch supplied by the vendor of my program.