开发者

How to convert the character encoding of string to UTF-8 from any encoding in PHP?

开发者 https://www.devze.com 2023-03-06 14:22 出处:网络
I need to convert the character encoding of string str to UTF-8 from any encoding in PHP. This code: $string = mb_convert_encoding($sring, \"utf-8\", \"开发者_如何转开发auto\");

I need to convert the character encoding of string str to UTF-8 from any encoding in PHP.

This code: $string = mb_convert_encoding($sring, "utf-8", "开发者_如何转开发auto"); sometimes returns warning: "mb_convert_encoding(): Unable to detect character encoding"


It is impossible to correctly guess the charset for any arbitrary text 100% of the time. Examine the source for clues to the charset (META tag, HTTP header, etc.).

0

精彩评论

暂无评论...
验证码 换一张
取 消