5

I have a government client that requires the legal 'section symbol' (§) in their documents. When creating the documents in a web page, this symbol is created with § or §.

I can not figure out how to get either of these to work in a pdf document created with FPDF. I have tried the iconv and utf8_decode methods, but neither have worked. Any ideas?

JJJ
  • 32,902
  • 20
  • 89
  • 102
seveninstl
  • 824
  • 1
  • 9
  • 17

2 Answers2

9

You're looking for html_entity_decode().

xkeshav
  • 53,360
  • 44
  • 177
  • 245
SLaks
  • 868,454
  • 176
  • 1,908
  • 1,964
  • 3
    Thanks for this. I need to add flag as "ENT_XHTML" and encoding as "ISO-8859-1". Then it works for me. html_entity_decode("£", ENT_XHTML,"ISO-8859-1") – cha Jan 08 '14 at 11:47
2

There is an easier approach to do this:

You can generate a section symbol using FPDF with using ascii code: chr(167).

It's good practice to make this a constant. At the top of your script, add:

define('SECTION',chr(167));

Now you can use SECTION in your script to print the euro symbol. For example:

echo SECTION.'1.1';

Will output: §1.1

Note: This will also work for other symbols with chr(ascii), where ascii is the ascii code of the symbol. You can find an overview of ascii codes on this page: http://www.atwebresults.com/ascii-codes.php?type=2

Gerard de Visser
  • 7,590
  • 9
  • 50
  • 58