{"id":853,"date":"2011-08-01T11:30:01","date_gmt":"2011-08-01T19:30:01","guid":{"rendered":"https:\/\/www.numinix.com\/blog\/?p=853"},"modified":"2020-03-13T14:25:15","modified_gmt":"2020-03-13T21:25:15","slug":"changing-the-charset-in-zen-cart-1-3-9-to-utf-8","status":"publish","type":"post","link":"https:\/\/www.numinix.com\/blog\/changing-the-charset-in-zen-cart-1-3-9-to-utf-8\/","title":{"rendered":"Changing the Charset in Zen Cart 1.3.9 to UTF-8"},"content":{"rendered":"<p>Regardless of whether you use accented or non-English characters in your descriptions and page content, setting up Zen Cart to use UTF-8 is recommended for the majority of stores.\u00a0 Today online shopping is globally accessible and from time to time you will get a customer whose name contains accented characters.\u00a0 In order to make these characters display properly in web pages and emails, the data needs to be stored and displayed using a supporting character set.\u00a0 The UTF-8 unicode charset supports the largest number of characters and is the charset we recommend for use with Zen Cart.<\/p>\n<p>Other tutorials, aimed more at Zen Cart v1.3.8 and prior, have stated that it is difficult to convert an existing Zen Cart store to use UTF-8.\u00a0 While this is true, it isn&#8217;t as difficult as one might expect as long as you have access to PHPMYADMIN and take a backup of your database before proceeding with this tutorial.<\/p>\n<p><strong>Step 1<\/strong><\/p>\n<p>Open includes\/languages\/YOUR_TEMPLATE\/english.php<\/p>\n<p>Find:<\/p>\n<p><code>@setlocale(LC_TIME, 'en_US.ISO_8859-1');<\/code><\/p>\n<p>And replace with:<\/p>\n<p><code>@setlocale(LC_TIME, 'en_US.utf8');<\/code><\/p>\n<p>Next find:<\/p>\n<p><code>define('CHARSET', 'iso-8859-1');<\/code><\/p>\n<p>And replace with:<\/p>\n<p><code>define('CHARSET', 'utf-8');<\/code><\/p>\n<p><strong>Step 2<\/strong><\/p>\n<p>Open YOUR_ADMIN\/includes\/languages\/english.php<\/p>\n<p>Find:<\/p>\n<p><code>setlocale(LC_TIME, 'en_US.ISO_8859-1');<\/code><\/p>\n<p>And replace with:<\/p>\n<p><code>setlocale(LC_TIME, 'en_US.utf8');<\/code><\/p>\n<p>Next find:<\/p>\n<p><code>define('CHARSET', 'iso-8859-1');<\/code><\/p>\n<p>And replace with:<\/p>\n<p><code>define('CHARSET', 'utf-8');<\/code><\/p>\n<p><strong>Step 3<\/strong> (will only work if you are using the file includes\/classes\/db\/mysql\/query_factory.php from Zen Cart 1.3.9+):<\/p>\n<p>Unzip and upload the attached file to includes\/extra_configures\/ and YOUR_ADMIN\/includes\/extra_configures\/:<\/p>\n<p><a href=\"https:\/\/www.numinix.com\/wordpress\/wp-content\/uploads\/2011\/08\/my_db_charset.zip\">my_db_charset<\/a><\/p>\n<p><strong>Step 4:<\/strong><\/p>\n<p>Open includes\/classes\/class.phpmailer.php<\/p>\n<p>Find:<\/p>\n<p><code>var $CharSet\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 = \"iso-8859-1\";<\/code><\/p>\n<p>Replace with:<\/p>\n<p><code>var $CharSet = \"utf-8\";<\/code><\/p>\n<p><strong>Step 5:<\/strong><\/p>\n<p>Connect to your database via PHPMYADMIN and click the Operations tab.<br \/>\nChange the &#8220;Collation&#8221; dropdown to &#8220;utf8_unicode_ci&#8221; and click &#8220;Go&#8221;.<\/p>\n<p>Then go through each table and change the table collation to &#8220;utf8_unicode_ci&#8221;.<\/p>\n<p>Within each table, click the Structure tab and for each column that uses varchar or char (datatypes that accept strings), change the collation to &#8220;utf8_unicode_ci&#8221;.<\/p>\n<p>Once you&#8217;ve completed this step, test that your shopping cart is acting as you would expect. Try changing a product&#8217;s description to include a UTF-8 encoded character. Then try registering a new customer with accented characters, or even Japanese symbols, in their name. Be sure to check the welcome email or order confirmation email to ensure that characters are being displayed correctly. If you encounter any issues, carefully check that you&#8217;ve completed every step outlined in this tutorial. If you are still encountering issues, we offer a conversion service which takes between 1-2 hours to complete. Contact support@numinix.com for more information.<\/p>\n<p><strong>Optional<\/strong>:<\/p>\n<p>Upgrading your Zen Cart store to the latest version after converting to UTF-8? Perform the following edit in zc_install\/includes\/installer_params.php:<\/p>\n<p>Find:<\/p>\n<p><code>define('DB_CHARSET', 'latin1');<\/code><\/p>\n<p>Replace with:<\/p>\n<p><code>define('DB_CHARSET', 'utf8');<\/code><\/p>\n<p>Also ensure that when replacing the files edited during this tutorial that you merge the changes.<\/p>\n<p><script type=\"application\/ld+json\">\n      {\n        \"@context\": \"http:\/\/schema.org\",\n        \"@type\": \"NewsArticle\",\n\t\"dateModified\": \"https:\/\/calendar.google.com\/calendar\/r\/day\/2019\/5\/29\",\n\t\"mainEntityOfPage\": \"https:\/\/www.numinix.com\/wordpress\/2011\/08\/01\/changing-the-charset-in-zen-cart-1-3-9-to-utf-8\/\",\n\"author\": {\n    \"@type\": \"Person\",\n    \"name\": \"Jenna Scaglione\"\n  },\n   \"publisher\": {\n    \"@type\": \"Organization\",\n    \"name\": \"Numinix Web Developers\",\n    \"logo\": {\n      \"@type\": \"ImageObject\",\n      \"url\": \"https:\/\/www.numinix.com\/images\/banner_hero_clarity.png\"\n    }\n    },\n        \"headline\": \"Changing the Charset in Zen Cart 1.3.9 to UTF-8\",\n        \"datePublished\": \"2011-08-1T16:00:41Z\",\n        \"image\": [\n          \"https:\/\/www.numinix.com\/wordpress\/wp-content\/uploads\/2019\/05\/web-design.jpg\"\n        ]\n      }\n    <\/script><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Regardless of whether you use accented or non-English characters in your descriptions and page content, setting up Zen Cart to use UTF-8 is recommended for the majority of stores.\u00a0 Today online shopping is globally accessible and from time to time you will get a customer whose name contains accented characters.\u00a0 In order to make these&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_lmt_disableupdate":"","_lmt_disable":"","_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[142,3],"tags":[341,346,343,342,345,344,8],"class_list":["post-853","post","type-post","status-publish","format-standard","hentry","category-tutorials","category-zen-cart-optimization","tag-1-3-9","tag-character-set","tag-charset","tag-iso-8859","tag-unicode","tag-utf-8","tag-zen-cart"],"modified_by":"Numinix Developer","jetpack_featured_media_url":"","jetpack-related-posts":[],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.numinix.com\/blog\/wp-json\/wp\/v2\/posts\/853","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.numinix.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.numinix.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.numinix.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.numinix.com\/blog\/wp-json\/wp\/v2\/comments?post=853"}],"version-history":[{"count":0,"href":"https:\/\/www.numinix.com\/blog\/wp-json\/wp\/v2\/posts\/853\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.numinix.com\/blog\/wp-json\/wp\/v2\/media?parent=853"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.numinix.com\/blog\/wp-json\/wp\/v2\/categories?post=853"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.numinix.com\/blog\/wp-json\/wp\/v2\/tags?post=853"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}