Search code examples
phphtmlmysqlinternationalizationfpdf

Change € symbol (saved in database) to € (Euro Symbol) in FPDF PHP


I want to show euro symbol that saved in mysql database, in mysql database the symbol is saved as "€", when I show in html it was automatically show as "€", is there a way to convert "€" to "€" again. Here is my code :

function GetRate($NoPo){
    global $dbname;

    $String = "SELECT ".$dbname.".ratesymbol from 
    WHERE code= '".$code."'";
    $Result = fetchData($String);
    return $Result; 
}
$DataRate = GetRate($_GET['code']);    
$pdf->MultiCell(0,4,$DataRate [0]['ratesymbol']) ',0,'L');

anybody can help ?


Solution

  • 1) Make sure your web pages are in UTF-8.

    2) Make sure your database holds UTF-8.

    3) Make sure your forms submit UTF-8.

    4) Make sure any database updates use UTF-8.

    Together these will roundtrip any characters in the Unicode code set.

    Also, ALWAYS use parameterized queries to avoid SQL injection attacks.