Opened 16 years ago

Closed 16 years ago

#1842 closed Bug (fixed)

Filename escape/encode problem causes XML error in file browser

Reported by: Mark van der Velden Owned by: Wiktor Walc
Priority: Normal Milestone: FCKeditor 2.6
Component: File Browser Version: FCKeditor 2.5.1
Keywords: Confirmed Review+ Cc:

Description

As briefly described in this topic: http://www.fckeditor.net/forums/viewtopic.php?f=6&t=8397#p22183 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 Wiktor Walc 16 years ago.

Download all attachments as: .zip

Change History (12)

comment:1 Changed 16 years ago by Wojciech Olchawa

Keywords: Pending added; ie ibrowser file browser xml encode escape removed
Priority: HighNormal

Hi!

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.

Thanks

comment:2 Changed 16 years ago by Alfonso Martínez de Lizarrondo

Wiktor:

I've tested to upload a file with Spanish letters to the images/test folder and now IE fails to load that folder. Loading http://www.fckeditor.net/fckeditor/editor/filemanager/connectors/php/connector.php?Command=GetFoldersAndFiles&Type=Image&CurrentFolder=%2Ftest%2F&uuid=1203851904656 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 16 years ago by Alfonso Martínez de Lizarrondo

Keywords: Confirmed added; Pending removed

comment:4 Changed 16 years ago by Wiktor Walc

Owner: set to Wiktor Walc
Status: newassigned

comment:5 Changed 16 years ago by Wiktor Walc

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 16 years ago by Wiktor Walc

Attachment: 1842.patch added

comment:6 Changed 16 years ago by Wiktor Walc

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 16 years ago by Wiktor Walc

Keywords: Review? added

comment:8 Changed 16 years ago by Wiktor Walc

Milestone: FCKeditor 2.6

comment:9 Changed 16 years ago by Frederico Caldeira Knabben

Keywords: Review+ added; Review? removed

comment:10 Changed 16 years ago by Wiktor Walc

Fixed with [1736].

comment:11 Changed 16 years ago by Wiktor Walc

Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy