Technical - Converting from iso-8859-1 to utf8 or utf8mb4

Modern sites should use UTF8 or UTF8MB4

Do I need to convert to UTF-8?

Short answer: yes.

Modern databases can handle “multibyte characters” such as emojis. Older databases cannot.

If your customers enter emoji symbols in order-comments or contact-us emails, it may trigger errors on your store resulting in unexpected results and lost details.

Also, older database structures don’t handle non-english characters as well as utf8 does, which is why utf8 has been the international “standard” for many years.

Since Zen Cart v1.5.0 all new sites install database tables with the UTF8 character-set.
Since Zen Cart v1.5.6 all new sites install database tables with the UTF8MB4 character-set.

If your site is from an older version, your database might still contain older data structures that don’t support modern multibyte characters.

To change the database to utf8mb4, use the instructions below.

Converting to UTF8MB4:

1. Use this conversion utility to convert your data to UTF8 (AFTER MAKING AND TESTING A DATABASE BACKUP):

https://github.com/zencart/utf8mb4-converter

2. Update your PHP files to indicate your UTF-8 intentions.

If you installed your site NEW since v1.5.0 or newer, then the following are ALREADY done for you.
But, if you UPGRADED from a version prior to 1.5.0, then you will need to double-check each of the following:

a. Check each of the following files to be sure that if a define for CHARSET is present that it is defined as utf-8. (If no define for CHARSET is present, skip that file and check the next one).

  • /admin/includes/languages/english.php
  • /admin/includes/languages/OTHER_LANGUAGE_NAME.php (if any)
  • /includes/languages/english.php
  • /includes/languages/TEMPLATE_NAME/english.php (if any)
  • /includes/languages/OTHER_LANGUAGE_NAME.php (if any)
  • /includes/languages/TEMPLATE_NAME/OTHER_LANGUAGE_NAME.php (if any)

b. Check your configure.php files:

  • /admin/includes/configure.php
  • /includes/configure.php

If they have a define for DB_CHARSET, make sure it is set to utf8 without the dash (not utf-8). (It may not be present: if so, that’s fine, go to the next file.)

(Remember, the configure.php files are most likely set to read-only on your server, so you’ll need to change their permissions on the server to be writable before you can save the changes you’re making.)

ASIDE: Useful video about the history behind why UTF8 was created: https://www.youtube.com/watch?v=MijmeoH9LT4




Still have questions? No problem! Just head over to the Zen Cart support forum and ask there in the appropriate subforum. In your post, please include your Zen Cart and PHP versions, and a link to your site.

Is there an error or omission on this page? Please post to General Questions on the support forum. Or, if you'd like to open a pull request, just review the guidelines and get started. You can even PR right here.
Last modified October 25, 2020 by Scott C Wilson (1358a23).