In checkout page in magento. In billing information when i select a country, states having special characters are not displayed.For ex: A Coruña,Ardèche .I got this error message in error.log

Warning: json_encode() [<a href='function.json-encode'>function.json-encode</a>]: Invalid UTF-8 sequence in argument in /chroot/home/site/html/lib/Zend/Json.php on line 146.

Is there any solution to overcome this problem.

4 Answers 4


The problem could be all character is UTF8, but json_encode does not handle it correctly.

here is a list of other characters (see Unicode characters list)

that will trigger the same error, so stripping off this one like (Å)

try below this could be help you.

htmlentities( (string) $value, ENT_QUOTES, 'utf-8', FALSE);
  • In which file i want to add this ?
    – Abinaya
    Commented May 30, 2014 at 6:39

worth to check in this class Mage_Directory_Helper_Data

In billing.phtml file this code update state selection dropdown var billingRegionUpdater = new RegionUpdater('billing:country_id', 'billing:region', 'billing:region_id', <?php echo $this->helper('directory')->getRegionJson() ?>, undefined, 'billing:postcode');

So change in this function _getRegions($storeId) as suggested by Mr Liyakat


I think the problem is that the value being encoded to json is not UTF-8 encoded data. PHP function json_encode, unfortunately, will only accept UTF-8 as its parameter.

You can try something like below

$state = mb_check_encoding($state, 'UTF-8') ? $state : utf8_encode($state);

before submitting the form.

I havn't tested it, but you can give it a try.

  • Where i want to add this code?
    – Abinaya
    Commented May 30, 2014 at 6:38
  • I am not sure but I guess, in billing.phtml in onepagecheckout Commented May 30, 2014 at 12:46

make sure the translation file itself was explicitely stored as UTF-8

After that reload cache blocks and translations

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.