Why is There a  in my MySQL Database?

By | February 4, 2016

Data submitted to a database via AJAX or other means sometimes includes a non-breaking space ( ). How this entity is displayed depends on the character encoding of the database and its tables.

Using the default Latin1 encoding, a non-breaking space is displayed as this little funny character right here -> Â

To have it displayed as an empty space, change the encoding scheme from Latin1 to UTF-8 (Unicode).

Set the default character sets on the database. This does not convert existing tables, it only sets the default for newly created tables.

ALTER DATABASE databasename CHARACTER SET utf8 COLLATE utf8_unicode_ci;

Next, convert the character set on all existing tables and their columns. In my experience, this has changed the existing  characters into blank spaces.

ALTER TABLE tablename CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;

References

http://stackoverflow.com/questions/4857778/when-to-use-utf-8-and-when-to-use-latin1-in-mysql

One thought on “Why is There a  in my MySQL Database?

  1. Daniel

    If you do it this way you will see blank spaces. But they are’nt!

    You will get in touch with that problem when you want to replace/change two spaces ” ” into one ” “.
    Or one space where a  was seen before!
    Nothing will happen, because this converted  is not an empty space!

    Try it!

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

*