How can I convert HTML character references (ף) to regular UTF-8?

后端 未结 2 1895
野趣味
野趣味 2021-01-03 02:02

I have some hebrew websites that contains character references like: נוף

I can only view these letters if I save the file

2条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-03 02:50

    Those are XML Character References. You want to decode them using html_entity_decode():

    $string = html_entity_decode($string, ENT_QUOTES, 'UTF-8');
    

    For more information, you can search Google for the entity in question. See these few examples:

    1. Hebrew Characters
    2. HTML Entities for Hebrew Characters
    3. UTF-8 Encoding Table with HTML entities

提交回复
热议问题