Why can't I display a pound (£) symbol in HTML?

前端 未结 8 983
醉酒成梦
醉酒成梦 2020-12-09 01:07

I\'m trying to display the pound symbol in HTML (from PHP) but all I get is a symbol with a question mark.

The following are things that I\'ve tried.

In PHP:

8条回答
  •  一个人的身影
    2020-12-09 01:38

    This works in all chrome, IE, Firefox.

    In Database > table > field type .for example set the symbol column TO varchar(2) utf8_bin php code:

    $symbol = '£';
    echo mb_convert_encoding($symbol, 'UTF-8', 'HTML-ENTITIES');
    or 
    html_entity_decode($symbol, ENT_NOQUOTES, 'UTF-8');
    

    And also make sure set the HTML OR XML encoding to encoding="UTF-8"

    Note: You should make sure that database, document type and php code all have a same encoding

    How ever the better solution would be using £

提交回复
热议问题