c# - Unicode issue with insert ZERO WIDTH SPACE into database -


i using ckeditor , seems possible correct keypresses following unicode character inserted textarea.

u+200b ​ \xe2\x80\x8b 0 width space

now when try save mysql database following error:-

mysql.data.mysqlclient.mysqlexception incorrect string value: '\xe2\x80\x8b </...' column 'content' @ row 1 

from can see have several options:-

  1. change collation on table, not entirely sure impact have on c# mvc4 application uses nhibernate orm
  2. strip out unicode string before insert database, not entirely how , if correct.
  3. this seems bug in ckeditor browsers, future proof myself not waiting fix.

so question best option around issue?

table structure

visibly charset latin1.

you shouldn't try store unicode data in latin1 column. have change that:

alter table campaignemail modify content longtext character set utf8 

beware when doing if erroneously stored "unicode-pretending-to-be-latin1" might put mess in table values.


btw charset encoding used map "letter" (strictly speaking: codepoint) "bytes".

the collation define relative order between various "letters". if used search/sort columns.


Comments

Popular posts from this blog

matlab - Deleting rows with specific rules -

php - MySQLi multi_query results for later use -