How to convert UTF-8 string to ANSI encoding in PHP

Source: Internet
Author: User
The main is to save the file, the system seems to accept only ANSI Chinese, but
Iconv ();
Mb_convert_encoding ();
Can't seem to translate directly.
It is said that the Windows system default file name is ANSI, but I set the page is UTF8, choose File Upload also did not appear garbled AH

Reply content:

The main is to save the file, the system seems to accept only ANSI Chinese, but
Iconv ();
Mb_convert_encoding ();
Can't seem to translate directly.
It is said that the Windows system default file name is ANSI, but I set the page is UTF8, choose File Upload also did not appear garbled AH

$name = iconv('utf-8','gb2312',$file['name']); //利用Iconv函数对文件名进行重新编码

Http://www.jb51.net/article/42660.htm
Have you tried it?

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.