[TYPO3-dev] Currency display from static_info_tables

Richard Davies richard at ocular.co.nz
Sun Aug 28 07:02:59 CEST 2011


Hi all,

I'm been adding multi-currency support to a shopping system, but having an
issue with the currency characters displaying correctly.
The system fetches the currency character from cu_symbol_left from
static_currencies in static_info_tables.
The issue I am having is that a few symbols occasionally display
incorrectly.
The euro symbol (€) is occasionally, maybe one in every ten times, is
displaying as (€).
The pound is occasionally displaying as £ instead of £. I understand that
the pound is actually stored as £, however if I remove the  it will
display £ then occasionally wont display any symbol. I'm confused, as there
should be nothing that influences the code: it always calls the same
function for display. Is this a mysql bug? I know there may be a character
encoding issue, but most of the time its displaying the correct symbol. Its
just every one in 10 or so fetches from the database it will display the
incorrect symbol.

$customiso = $GLOBALS["TSFE"]->fe_user->getKey("ses","customiso");
            if($customiso){
                $iso = $customiso;
            }
            $data=$GLOBALS['TYPO3_DB']->exec_SELECTquery('cu_symbol_left,
cu_thousands_point, cu_decimal_point, conversion','
static_currencies','cu_iso_nr=\''.$iso.'\'');
            $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($data);
            $thousandsSeperator =  $row['cu_thousands_point'];
            $decimalSeperator =  $row['cu_decimal_point'];
//added column conversion to static_currencies, it was doing this before i
added the row conversion though
            $exchangeVersion = $row['conversion'];
            //because UTF-8 doesnt play well with certain currencies e.g.
pound
            $convmap= array(0x0100, 0xFFFF, 0, 0xFFFF);
            $encutf= mb_encode_numericentity($row['cu_symbol_left'],
$convmap, 'UTF-8');
            echo utf8_decode($encutf);

Thanks
Richard




More information about the TYPO3-dev mailing list