Jump to content

Character set problem?


Recommended Posts

Hi everyone,

I have this

<?php setlocale(LC_MONETARY, 'en_GB'); echo money_format('%#4n', $row_getsum['SUM_value']) . "\n"; ?>

 

to output a total figure/sum of all number in my db. The £ sign is being displayed as a question mark (mac) square (PC) stating I have an incorrect character set from what I've gathered, does anybody know how I can combat this?

Link to comment
https://forums.phpfreaks.com/topic/202385-character-set-problem/
Share on other sites

Try converting the pound symbol into the html entity for the symbol before displaying it:

 

<?php
setlocale(LC_MONETARY, 'en_GB');
$amount = money_format('%#4n', $row_getsum['SUM_value']) . "\n";
echo htmlentities($amount, ENT_NOQUOTES, 'ISO-8859-1');
?>

 

Also make sure that the page is being encoding with the matching charset by setting it in the page <head>:

 

<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />

 

This is assuming you are making a site with a western Latin charset.  Ideally you should use UTF-8 for a greater degree of internationalism.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.