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