Solutions to phpfck folder and Chinese garbled characters for uploading images

Source: Internet
Author: User
The main cause of the problem is that the encoding (UTF-8) code in fck is closely inconsistent with the local encoding (gbk, you can modify the following five files. Solve the Chinese folder garbled problem: file 1: fckeditoreditorfilemanagerbrowserdefabrowser.html find the oConnector. SendC php fck folder and upload the picture Chinese garbled problem solution

The main cause is that the encoding (UTF-8) code in fck is closely inconsistent with the local encoding (gbk). the following five files can be modified.

Solve Chinese folder garbled characters:

File 1: \ fckeditor \ editor \ filemanager \ browser \ default \ browser.html

Find

OConnector. SendCommand = function (command, params, callBackFunction)

{

?????? Var sUrl = this. ConnectorUrl + 'command = '+ Command;

?????? SUrl + = '& Type =' + this. ResourceType;

//???? SUrl + = '& CurrentFolder =' + encodeURIComponent (this. CurrentFolder );

?????? SUrl + = '& CurrentFolder =' +? This. CurrentFolder ;?

?

?????? If (params) sUrl + = '&' + params;

?

?????? // Add a random salt to avoid getting a cached version of the command execution

?????? SUrl + = '& uuid =' + new Date (). getTime ();

?

?????? Var oXML = new FCKXml ();

?

?????? If (callBackFunction)

????????????? OXML. LoadUrl (sUrl, callBackFunction );?? // Asynchronous load.

?????? Else

????????????? Return oXML. LoadUrl (sUrl );

?

?????? Return null;

}

Remove the encodeURIComponent function.

?

File 2: \ fckeditor \ editor \ filemanager \ browser \ default \ frmcreatefolder.html

Find

Function CreateFolder ()

{

?????? Var sFolderName;

?

?????? While (true)

?????? {

????????????? SFolderName = prompt ('Type the name of the new folder :','');

?

????????????? If (sFolderName = null)

???????????????????? Return;

????????????? Else if (sFolderName. length = 0)

???????????????????? Alert ('Please type the folder name ');

????????????? Else

???????????????????? Break;

?????? }

?

//???? OConnector. SendCommand ('createfolder', 'newfoldername = '+ encodeURIComponent (sFolderName), CreateFolderCallBack );

?????? OConnector. SendCommand ('createfolder', 'newfoldername = '+ sFolderName, CreateFolderCallBack );

}

Remove the encodeURIComponent function.

?

File 3: \ fckeditor \ editor \ filemanager \ browser \ default \ frmresourceslist.html

Find

Function OpenFile (fileUrl)

{

//???? Window. top. opener. SetUrl (encodeURI (fileUrl). replace ('#', '% 23 '));

?????? Window. top. opener. SetUrl (fileUrl );

?????? Window. top. close ();

?????? Window. top. opener. focus ();

}

Remove the encodeURI function.

?

Solve the problem of garbled Chinese file names for uploaded images:

File 4: \ fckeditor \ editor \ filemanager \ connectors \ php \ commands. php

Find

Function FileUpload ($ resourceType, $ currentFolder, $ sCommand ){

...

? ??? Find

? ??? // Move_uploaded_file ($ oFile ['tmp _ name'], $ sFilePath );

Move_uploaded_file ($ oFile ['tmp _ name'], iconv ("UTF-8", "gbk", $ sFilePath ));

}

Transcode the file name $ sFilePath.

?

File 5: \ fckeditor \ editor \ filemanager \ connectors \ php \ util. php

Find

Function ConvertToXmlAttribute ($ value ){

?????? ...

?????? Find

????? // Return (utf8_encode (htmlspecialchars ($ value )));

?????? Return iconv ("GBK", "UTF-8", htmlspecialchars ($ value ));

}

Transcode the content.

?

The original I mentioned related problems in the blog: http://simpledev.iteye.com/blog/371619

(For details, refer to: directly overwrite files with attachments)

Sorting 120521

?

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.