CP936 transcoding UTF-8 failed? How to deal with encoding in CP936 format

when uploading a file to obtain the file name encoding, the prompt is CP936 format

.
mb_detect_encoding($file_name, array("ASCII","GB2312","GBK","UTF-8"));

Baidu says that CP936 is actually GBK. But using

iconv("CP936", "UTF-8//IGNORE", $file_name);

when transcoding, the code is garbled, and the result is uploaded room.png . The original file name is queue. PNG
does not transcode, and it is also the name saved locally. PNG when directly saved locally.

I would like to ask how to transcode a file whose name is in the format of CP936 .

Mar.28,2021

you have used mb_detect_encoding , why not mb_convert_encoding ?


encounter the same problem, solve?

Menu