Added an encoder for PHP < 5.3.7