I’ve been running into several problems with restoring MySQL backups. Namely, the backups come from an environment other than the one I’m working in and I’m forced to remove superuser commands contained in the backups.

The problem is when trying to remove those commands I’m constantly getting UTF-8 encoding errors because there are loads of invalid character sequences.

Why would MySQL encode a backup as UTF-8 if the data isn’t actually UTF-8? This feels like bad design to me.

  • @folekaule
    link
    23 days ago

    The Unicode standard allows, but recommends against, adding a BOM for utf8 files. Utf8 does not need them.

    I’ve only seen Microsoft tools adding that, and it breaks some parsers.

    Please don’t add BOM to utf8 files unless for some reason you need them.