The complete framework is based (or should be) upon UTF-8.
Just convert the output from UTF-8 to your wished encoding.

But you should expect problems, as many characters, including some currency symbols, are only available within UTF-8.

Using multilingual components it is highly recommended to use UTF-8 as default encoding for the complete application.

Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com

----- Original Message ----- From: "Amaamarivissi -" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Monday, May 05, 2008 1:32 PM
Subject: [fw-general] Question: currency formatting and charset


Hi!

I'm trying to get a formatted currency, but the currency symbol is
misrepresented; my character set is ISO-8859-1 but the symbol appears
to be in UTF-8. Does anyone know how to solve this?

Snippet:

<?php

require_once('Zend/Currency.php');
require_once('Zend/Debug.php');

class TestController extends Zend_Controller_Action {

   public function indexAction() {
       $this->_helper->viewRenderer->setNoRender();

       ini_set('default_charset', 'ISO-8859-1');

       // Uncomment to get the correct results
       // ini_set('default_charset', 'UTF-8');

       // Expected: ISO-8859-1
       // Actual: ISO-8859-1
       Zend_Debug::dump(iconv_get_encoding('internal_encoding'));

       $currency = new Zend_Currency('nl_NL'); // Dutch

       // Expected: € 120,45
       // Actual: € 120,45
       Zend_Debug::dump($currency->toCurrency(120.45));

       // Expected: ISO-8859-1
       // Actual: UTF-8
       Zend_Debug::dump(iconv_get_encoding('internal_encoding'));
   }
}

?>

Thanks!


Reply via email to