简体   繁体   中英

Read unicode file in php

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

您可以使用iconv将unicode字符串转换为任何其他编码。

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-8
  • utf8_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 .

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM