Reputation: 22424
I am using CKEditor and it seems that it is possible with the correct keypresses to get the following unicode character inserted into the textarea.
U+200B \xe2\x80\x8b ZERO WIDTH SPACE
Now when I try to save this into a MySQL database I get the following error:-
MySql.Data.MySqlClient.MySqlException
Incorrect string value: '\xE2\x80\x8B </...' for column 'Content' at row 1
From what I can see I have a several options:-
So my question is simply what is my best option to get around this issue?
Upvotes: 1
Views: 3498
Reputation: 52000
Visibly your charset
is Latin1.
You shouldn't try to store unicode data in Latin1 column. You will probably have to change that:
ALTER TABLE campaignemail MODIFY Content LONGTEXT CHARACTER SET utf8
Beware when doing so that if you erroneously stored "unicode-pretending-to-be-latin1" this might put a mess in your table values.
BTW the charset
is the encoding used to map from a "letter" (strictly speaking: a codepoint) to "bytes".
The collation
define the relative order between the various "letters". If is used to search/sort columns.
Upvotes: 1