Grow your CSS skills. Land your dream job.

Collation vs charset

  • # February 4, 2013 at 11:54 am

    When speaking of a MySQL db, are Collation and Charset the same?

    I’ve seen a post on stackoverflow that states: ‘The column that you describe is text utf8_unicode_ci. utf8_unicode_ci is the collation, make sure the charset on that column is set to utf8.’

    I more-often-than-not use a collation of ‘utf8_general_ci’.

    That just made me wonder if the two terms are interchangeable when it comes to MySQL databases.

    This entire thing is coming up for a reason, [HTMLPurifier](http://htmlpurifier.org/ “HTMLPurifier”) converting the nbsp; character as Â. Not sure why but upon conversion that lead to a giant can of worms.

    # February 4, 2013 at 9:51 pm

    http://www.informit.com/articles/article.aspx?p=328641

    That’s a good article explaining it.

    # February 5, 2013 at 9:50 am

    Thanks for this link. The first page alone describes the difference better than anything else I’ve found.

    I am trying to wrap my head around the issue I’m having. Perhaps someone can shed some light.
    I use HTMLPurifier and am having the seemingly common problem of the   character being converted to the weird A character.

    Chrome shows that the page encoding is UTF-8. My database has MySQL charset: UTF-8 Unicode (utf8), so there should be no issue there from what I understand.

    The text comes from CKEditor in a $_POST variable. It displays fine, and then I process it with HTMLPurifier and it displays the strong “A” character for each  
    This is before anything is stored in a database. Just displaying the results of the purifying process.

    Any help is welcome. I’ve read up on it and I can’t see what I’m doing incorrectly with character sets to make this happen.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".