Magento: “Wrong charset, conversion from `UTF-16BE’ to `UTF-8′ is not allowed”

We have noticed this issue cropping up with Magento. Whilst we originally assumed it was a system level fault, further testing has revealed there is an issue with the implementation of iconv() in Magento. There was a problem with Magento converting strings between character sets, specifically when creating a PDF invoice. Initial testing with a simple PHP script was positive. <?php print_r ( iconv_get_encoding()); print_r(get_loaded_extensions ()); print_r(get_defined_constants(true)); printf(" %s n",ICONV_IMPL); printf(" %s n",ICONV_VERSION); echo iconv(‘UTF-8′, ‘ASCII//TRANSLIT’, "test"); echo "n"; echo iconv(‘ASCII’, ‘UTF-8//TRANSLIT’, "test"); echo "n"; echo iconv(‘UTF-8′, ‘ISO-8859-1//TRANSLIT’, "test"); echo "n"; echo iconv(‘ISO-8859-1′, ‘UTF-8//TRANSLIT’, "test"); echo "n"; echo iconv(‘UTF-8′, ‘ISO-8859-1′, "test"); echo "n"; echo iconv(‘ISO-8859-1′, ‘UTF-8′, "test"); echo "n"; echo iconv(‘UTF-16BE’, ‘UTF-8′, "test"); echo "n"; echo iconv(‘UTF-8′, ‘UTF-16BE’, "test"); echo "n"; ?> There obviously was not an issue with our implemental of glibc or iconv libs. However, when used in Magento’s code, it threw an error. We do not know … Continue reading

Magento: Admin area stall/freeze

After noting some downtime issues recently with Magentocommerce.com – it has come to our attention that it has had a possible impact on stores. When Magentocommerce went down this afternoon – the admin area on all of our hosted stores became non-responsive. As a test, we thought perhaps the version checking facility in the admin (to check for new messages/updates) might be hanging and causing an issue. We subsequently added, 127.0.0.1 <strong>magentocommerce.com www.magentocommerce.com</strong> To the /etc/hosts file, then after, trying to access the admin was immediate without any hang/stall. This immediately resolved the issue, but is not an ideal solution, we shall be adding this issue to the bug tracker.

Magento: mini_sendmail and Zend_Mail incompatibility

This article is now deprecated and the issue has been resolved without changes to core code after our service change. We have recently spotted an issue after traversing our Apache sendmail application to mini_sendmail (read more about the change). In Magento’s mail headers, the recipient and sender details have both the email address and respective name, however, this breaks compatibility with mini_sendmail. As mini_sendmail does not support anything other than just the email address alone for the recipient/sender, emails from Magento will fail to send. As a temporary measure a fix can be issued in the form of editing core code. 1) Enter the root directory of your Magento store and enter # mkdir app/code/local/Mage # mkdir app/code/local/Mage/Core # mkdir app/code/local/Mage/Core/Model # mkdir app/code/local/Mage/Core/Model/Email # cp app/code/core/Mage/Core/Model/Email/Template.php app/code/local/Mage/Core/Model/Email/ 2) Using your favourite editor open up Template.php and make changes at these lines ini_set(‘SMTP’, Mage::getStoreConfig(‘system/smtp/host’)); ini_set(‘smtp_port’, Mage::getStoreConfig(‘system/smtp/port’)); $mail = $this->getMail(); if … Continue reading

PHP: Combine and compile CSS and JS into Gzipped files

This has actually been the secret behind a lot of our great system performance, but as it was open source originally, it’s going back to the people. Its a relatively straightforward script and speeds up JS and CSS performance by a huge amount, especially if you are using multiple files (like we do!). It should be noted that the compression and combining engine is standard on all hosting accounts – just skip straight to step 5. The red settings represent paths that need to be set dependant on where you put the files. It is based on the combine script by Rakaz (http://rakaz.nl/item/make_your_pages_load_faster_by_combining_and_compressing_javascript_and_css_files), but there were notable flaws in that version. gZip encoding was not handled correctly by the browser cache files build up (requires cron to remove routinely) content echo’ing and incorrect headers causing slowdowns Our version is about 100-200% faster than the original build, we thank Rakaz for … Continue reading

So what makes us the fastest Magento host then …

As we’ve been developing Magento sites for almost a year now, I think we can start to say we’re getting proficient at the inner workings. So much so, that with our expanding hosting range – we’ve been tweaking our server to squeeze the best possible performance out of Magento. What looks to have been an uphill struggle for most, after a good few weeks of userspace tweaking, we’ve gotten the best consistent performance from our installs now. So I thought I might let you guys in on how to get a little more out of your current server – then when you want more performance, try out our Magento consultancy offerings. First, its best to point people to http://www.magentocommerce.com/boards/viewthread/9037/, it hits the nail on the head for a lot of key points. Then for a quick follow up read this, http://www.magentocommerce.com/boards/viewthread/36225/. But I’m going to rule out any optimisations in … Continue reading