PHP export CSV when data having UTF8 charcters

后端 未结 4 1474
花落未央
花落未央 2021-02-14 03:49

In MySQL I have set my data field type to utf8_bin and i am storing data in Unicode. Texts are being properly displayed in web pages.

I want to generate ex

4条回答
  •  面向向阳花
    2021-02-14 04:27

    This post solved my problem: https://stackoverflow.com/a/4762708/2349494

    And this is what did the conversion:

    print chr(255) . chr(254) . mb_convert_encoding($csv_output, 'UTF-16LE', 'UTF-8');
    

    Earlier I was getting garbage characters now correct data is exported.

提交回复
热议问题