Html entities like € is not converted to its symbol in CSV conversion

前端 未结 6 581
别跟我提以往
别跟我提以往 2021-01-19 16:13

I have used CSV parser from http://code.google.com/p/parsecsv-for-php/, to export my reports to CSV in PHP. I have displayed Sales Total value in €XXXX.XX

6条回答
  •  梦谈多话
    2021-01-19 16:18

    You would need to use html_entity_decode() on the strings before writing them to file, which will find all html entities and replace them with their actual symbol.

    html_special_chars() and html_special_chars_decode() only works on a few html entities, like > and <, while htmlentities() and html_entity_decode() works on all of them.

    Alternatively, you could just do a string replace (str_replace() or preg_replace() or whatever) for to replace with .

    Then Try:

    str_replace('€','€',$valuebeingexported);

提交回复
热议问题