Announcement

Collapse
No announcement yet.

mysqli/charset 'utf8' should be 'utf8mb4'

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • mysqli/charset 'utf8' should be 'utf8mb4'

    File /core/includes/config.php file includes an example line like this;

    // $config['Mysqli']['charset'] = 'utf8';

    and the readme from the utf8 toolset also says to set that charset to 'utf8' after conversion.

    However, I found that it needs to be $config['Mysqli']['charset'] = 'utf8mb4'; for it show the emoji's properly. If I comment out the line entire it works as well, but with line active and set to 'utf8' the smileys shows as '?'

    Also we did the utf8 conversion on our VB4 database prior to upgrade to VB5. But that still created Latin tables. We rolled back (test site) to VB4 ISAM db, did conversion again but then also did:
    ALTER DATABASE forums
    DEFAULT CHARACTER SET utf8mb4
    DEFAULT COLLATE utf8mb4_general_ci;


    We did the VB562 upgrade on that and it created the new tables as utf8 as intended. Might want to add that to utf8tools readme?

  • #2
    The majority of the time, the config.php file does not need to be changed if the mysql connection is changed on the database. Systems are a lot easier to manage if this is left commented out and the database takes care of the connection.
    Translations provided by Google.

    Wayne Luke
    The Rabid Badger - a vBulletin Cloud demonstration site.
    vBulletin 5 API - Full / Mobile
    Vote for your favorite feature requests and the bugs you want to see fixed.

    Comment


    • #3
      I do convert my datase to UTF8 using the utf8 tools and steps. That goes fine.

      I unzip VB562, place/make a core/includes/config.php


      If I don't do the 'alter the database' described above AND I leave the charset in config.php commented out I end up with vb5 tables in latin1.

      If I do the 'alter the database' described above AND I leave the charset in config.php commented out I get a updater warning "Your database has a character set of 'utf8mb4', but your mysql connection character set is 'latin1'. This can cause problems when rendering text if you installed your site prior to version 5.2.5. Setting $config['Mysqli']['charset'] to 'latin1' in your configuration file will restore the previous behavior recommended prior to upgrading to 5.2.5 or later."

      If I do the 'alter the database' described above AND I uncomment the charset in config.php and set it to 'utf8mb4' the updater just works and I get my shiny new tables as UTF8.

      Mysqli doesn't seem smart enough to pick up that database it is connecting to has a default charset of utf8mb4 , I don't see how I could work around that without using that option?
      I'm prefectly willing to TRY, but I've tried all combinations coming from a VB422 db->converted to utf8->update to VB562 scenario.


      Comment


      • #4
        The ALTER DATABASE command that you mention is what tells vBulletin how to connect to the database. If it is not done, then the config.php line is needed. We don't force it because we do not know what other tables that the user has in that table or what they are doing with them. Some people install multiple applications or even multiple vBulletin installations in the same database. This isn't recommended but it happens.

        On new systems using MySQL 8 (the current recommended version), the default database connection and collation will be UTF8MB4.
        Translations provided by Google.

        Wayne Luke
        The Rabid Badger - a vBulletin Cloud demonstration site.
        vBulletin 5 API - Full / Mobile
        Vote for your favorite feature requests and the bugs you want to see fixed.

        Comment


        • #5
          We run mysql5.7 at the moment. If we do only the alter database without changing config.php we get the warning in the installer/updater so I figured it is recommended to also set the charset in config.php ?

          The mysql is dedicated to VB so we can do with what we like In that setup setting charset in config.php should be fine?

          p.s. thanks for the quick replies, very nice!

          Comment

          Related Topics

          Collapse

          Working...
          X