Reputation: 2155
How to read Unicode file in php.
I have used file_get_contents() function, but after reading file content, I am getting content in decode format(not readable format)
Please provide me your suggestions.
Thanks
-Pravin
Upvotes: 2
Views: 7552
Reputation: 316969
Since you tagged this unicode decode/encode, try running the content you got from file_get_contents
through
utf8_encode
— Encodes an ISO-8859-1 string to UTF-8utf8_decode
— Converts a string with ISO-8859-1 characters encoded with UTF-8 to single-byte ISO-8859-1 If your file content is not ISO-8859-1, consider Elzo's answer to use iconv
.
Upvotes: 1
Reputation: 27866
You can use iconv to transform your unicode string to any other encoding.
Upvotes: 3