List Info

Thread: Question: currency formatting and charset




Question: currency formatting and charset
user name
2008-05-05 06:32:21
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!
Re: Question: currency formatting and charset
user name
2008-05-05 06:54:39
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 -" <amaamarivissigmail.com>
To: <fw-generallists.zend.com>
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!
> 


Re: Question: currency formatting and charset
user name
2008-05-05 17:28:12
Amaamarivissi wrote:
>        // Expected: € 120,45
>        // Expected: ISO-8859-1

There is no Euro symbol in ISO-8859-1.

nico
Re: Question: currency formatting and charset
user name
2008-05-06 07:27:11
I knew there was something suspicious...
ISO-8859-15 is with euro sign. 

Thank you Nico

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

----- Original Message ----- 
From: "Nico Edtinger" <nicoedtinger.at>
To: "Amaamarivissi -" <amaamarivissigmail.com>
Cc: <fw-generallists.zend.com>
Sent: Tuesday, May 06, 2008 12:28 AM
Subject: Re: [fw-general] Question: currency formatting and
charset


Amaamarivissi wrote:
>        // Expected: € 120,45
>        // Expected: ISO-8859-1

There is no Euro symbol in ISO-8859-1.

nico= 


[1-4]

about | contact  Other archives ( Real Estate discussion Medical topics )