Opened 9 years ago

Closed 9 years ago

#1842 closed Bug (fixed)

Filename escape/encode problem causes XML error in file browser

Reported by: Dynom Owned by: wwalc
Priority: Normal Milestone: FCKeditor 2.6
Component: File Browser Version: FCKeditor 2.5.1
Keywords: Confirmed Review+ Cc:


As briefly described in this topic: Filenames with special characters in it cause the XML used in the iBrowser to be invalid which breaks IE browsers.

Attachments (1)

1842.patch (4.9 KB) - added by wwalc 9 years ago.

Download all attachments as: .zip

Change History (12)

comment:1 Changed 9 years ago by w.olchawa

  • Keywords Pending added; ie ibrowser file browser xml encode escape removed
  • Priority changed from High to Normal


I've viewed the forum but I was unable to find what kind of "special characters" is this bug referring to. Please write if I have missed it in the forum.


comment:2 Changed 9 years ago by alfonsoml


I've tested to upload a file with Spanish letters to the images/test folder and now IE fails to load that folder. Loading in IE7 says that there are some invalid characters.

The picture was uploaded with IE7 also.

In Firefox the list of files is shown, but instead of the proper letters it shows ? for the special characters.

So if the file gets deleted and you need to test it just drop me a note and I'll upload it again.

Note: I've uploaded that same file to the CKFinder demo and it works fine there.

comment:3 Changed 9 years ago by alfonsoml

  • Keywords Confirmed added; Pending removed

comment:4 Changed 9 years ago by wwalc

  • Owner set to wwalc
  • Status changed from new to assigned

comment:5 Changed 9 years ago by wwalc

This issue has been also described in #1036.

The main problem is that in some of the html files used by file browser utf-8 headers were missing:

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

Because of that, IE sent file names in its internal system encoding, whilst everyting was working fine in Firefox (used utf-8 as a defult to send names of uploaded files). Acutally FCKeditor could work fine even in IE, if utf-8 encoding was forced by apache configuration.

Anyway, utf-8 headers must be set in all pages which are responsible for managing files. This will fix problems with uploading files in IE in the future.

However, we have still unresolveable problem with files that have been already uploaded (...or have been uploaded by poor FTP client). Their name may be an invalid utf-8 string, which breaks XML responses in IE (Firefox ignores that problem). To fix that, ConvertToXmlAttribute function on *nix systems must check whether file name is a valid utf string: if not, encode it *somehow*. We have no information what was the initial encoding that IE had used, so we could use utf8_encode which is available in core in all PHP versions. It encodes string assuming that given string is encoded in ISO-8859-1.

Unfortunately it means that if someone uploaded file in IE and his Windows used different charset than ISO-8859-1, his file will be displayed, but its name will be wrong (due to wrong encoding used in conversion). But this is still a lot better that being unable to display the list of files.

To completely fix this issue, we would have to be able to sent non-utf file names in XML responses, so file names would have to be sent in rawurlencoded format.

Changed 9 years ago by wwalc

comment:6 Changed 9 years ago by wwalc

The patch above fixes all that we can fix with current behaviour of file browser. As I wrote, to completely solve this issue, file names would have to be send in a safe format (rawurlencoded).

comment:7 Changed 9 years ago by wwalc

  • Keywords Review? added

comment:8 Changed 9 years ago by wwalc

  • Milestone set to FCKeditor 2.6

comment:9 Changed 9 years ago by fredck

  • Keywords Review+ added; Review? removed

comment:10 Changed 9 years ago by wwalc

Fixed with [1736].

comment:11 Changed 9 years ago by wwalc

  • Resolution set to fixed
  • Status changed from assigned to closed
Note: See TracTickets for help on using tickets.
© 2003 – 2016 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy