2

I have this string passed from a JavaScript form: 4 H/M’s

Which gets posted to an array, called '$out' and is keyed by "blurb".

I use FPDF to output it, with MultiCell, like so:

$pdf->MultiCell(190,4,$out["blurb"]);

However, FPDF outputs this string:

4 H/M’s

I've tried

html_entity_decode($out["blurb"], ENT_QUOTES, "UTF-8")

but it doesn't seem to be working. Any suggestions?

user1114864
  • 1,734
  • 6
  • 26
  • 37

1 Answers1

0

Use iconv like this :

// put $str your sting to encode for FPDF
// put $myencoding value as you current encoding
function fpdf_encode($str,$myencoding='latin1') { 
  return iconv($myencoding, 'windows-1252', trim(utf8_decode($str)));
}
Ryan M
  • 18,333
  • 31
  • 67
  • 74