Strange strings that cannot be inserted into a table

Posted on 2012-08-19
Last Modified: 2012-10-03
I'm collecting some random tweets.  For some of the tweets, I failed to insert their body into a MySQL database.  Following is the error message I received.

Incorrect string value: '\xF0\x9F\x91\xAF\xF0\x9F...' for column 'tweetBody' at row 1

Open in new window

Here is the tweet body.

Tell Tyga look for this chick called black china sill a nigga bitch ???? In a hot flash ?? menopause hot flash

Open in new window

I believe it's because of the squares.  The collation of the database is utf8 - default collation.

Question by:thomaszhwang
    LVL 8

    Assisted Solution

    How are you escaping the text upon inserting?  Are you using mysql_real_escape_string() or similar?
    LVL 24

    Accepted Solution

    What version of MySQL are you on?  What you are dealing with seem to be 4-byte UTF-8 characters.  Basically any version of MySQL before 5.5.3 cannot handle 4-byte utf-8 yet.  Possible solutions:

    1.  Upgrade MySQL to 5.5.3
    2.  Convert the fields to varbinary (

    Author Closing Comment


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    Loading csv or delimited data files to MySQL database is a very common task frequently questioned about and almost every time LOAD DATA INFILE comes to the rescue. Here we will try to understand some of the very common scenarios for loading data …
    This guide whil teach how to setup live replication (database mirroring) on 2 servers for backup or other purposes. In our example situation we have this network schema (see atachment). We need to replicate EVERY executed SQL query on server 1 to…
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    8 Experts available now in Live!

    Get 1:1 Help Now