I want to export some of my data into CSV with the help of PHP. The code is working correctly but some of the keywords that I want to export was in some other unicode which I had saved in database using
urlencode('אריה דרעי');
This saved the unicode in this format in database:
%26%231488%3B%26%231512%3B%26%231497%3B%26%231492%3B+%26%231491%3B%26%231512%3B%26%231506%3B%26%231497%3B
The main problem here is when I display it in an HTML page it displays fine but when I try to export it in CSV it shows the same texts.
I tried to use following function
url_decode('%26%231488%3B%26%231512%3B%26%231497%3B%26%231492%3B+%26%231491%3B%26%231512%3B%26%231506%3B%26%231497%3B');
But it again genereated special characters as
אריה דרעי
Then I tried it to further decode using
htmlspecialchars_decode();
But still it shows אריה דרעי in the CSV files.
I hope I make sense.
Try using htmlspecialchars() instead of url_encode()
http://www.php.net/manual/en/function.htmlspecialchars.php and http://www.php.net/manual/en/function.htmlspecialchars-decode.php
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.