How to solve Chinese file name garbled characters in files uploaded by moodle

Source: Internet
Author: User
Completely solves the problem of incorrect Chinese file names in files uploaded by moodle. Thank you for choosing [8:19:00].

2 recommended

Moodle does not support Chinese well, which is a widely recognized bug. You can find some solutions on the Internet. The simplest solution is: --------------------------------- config. php.
$ Cfg-> unicodecleanfilename = true; ===================================================== 1.9 if you have tried this, you just need to change it. now
You can upload the document name in Normal Mode -------------------------- I also found such a description in lib/moodlelib. php. It turned out to be an official solution :/**
* Cleans a given filename by removing suspicious or troublesome characters
* Only these are allowed: alphanumeric _-.
* Unicode characters can be enabled by setting $ cfg-> unicodecleanfilename = true in config. php
*
* Warning: Unicode characters may not be compatible with zip compression in backup/restore,
* Because native zip binaries do weird character conversions. Use PHP zipping instead.
*
* @ Param string $ string file name
* @ Return string cleaned file name
*/In fact, this is not a thorough solution. If you select this site file when inserting a hyperlink, the Chinese file name in the returned file directory is garbled. However, I found that UTF-8 encoding can still be viewed correctly in the browser, but this is inconvenient after all. I can no longer find relevant information, so I am self-reliant. I found some PHP information and directly modified coursefiles. PHP file (LIB/Editor/htmlarea/coursefiles. PHP), add the following sentence to the second line: @ header ("Content-Type: text/html; charset = UTF-8"); test the webpage again, the browser can automatically select UTF-8 encoding without garbled characters. Finally, it completely solves the problem of garbled Chinese file names.

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.