Search code examples
mysqlvb.netcharacterutf8mb4

How to get rid all strange characters that can't get into mysql from a string in vb.net


I have a problem with strange character.

In mysql this character 💀 cause error Incorrect string value: '\xF0\x9F\x92\x80'

Samples of these characters are from https://foursquare.com/v/shabushi-%E0%B8%8A%E0%B8%B2%E0%B8%9A%E0%B8%8A/4b72452cf964a5203c762de3

Say I want to analyze data from the web and found some strange character

how to remove this character 💀 ??

The occurance is rare.

In fact, how to know all characters that may be problematic for mysql and remove that? I am not saying escapeable characers. I am saying characters that are neither numeric, alphabeth, or chinese scripts, or punctuation. Characters that's totally bizarre.

How do I get rid of that from a string?


Solution

  • Older versions of MySQL can't deal with characters outside the BMP; upgrade your MySQL to at least 5.5 and set the column to use the utf8mb4 charset.