You are here: Foswiki>Tasks Web>Item625 (05 Jul 2015, GeorgeClark)Edit Attach

Item625: Uploaded filename stripped if special character

Priority: Normal
Current State: Closed
Released In: 2.0.0
Target Release: major
Applies To: Engine
Component: I18N
Reported By: Foswiki:Main.KwangErnLiew
Waiting For:
Last Change By: GeorgeClark
When uploading a file with special characters, e.g Ba-Benzélé.file, the special character is stripped off to Ba-Benzl.file

Example can be found @

I've also tried chinese characters 示范.file in UploadFilenameTest but the following error got thrown back at me.

Either you did not specify a file name, or the file you are trying to upload blank :) has no content. You may not upload an empty file.
Please go back in your browser and check again. 

Note: blank :) is the content of the file.

On my box (4.1.2), I tried to scp the file to the appropriate pub directory, and it works, i.e. the attachment is displayed on the topic.
You don't say how your system is configured. Locale? Charset? Are you using utf8? There is a function Foswiki::Sandbox::sanitiseAttachmentName. What is it doing wrong?

-- CrawfordCurrie - 04 Jan 2009 has the following configuration,
$Foswiki::cfg{Site}{Locale} = 'en_US.ISO-8859-1';
$Foswiki::cfg{Site}{CharSet} = 'iso-8859-1';

My site running 4.1.2 has the following configuration,
$TWiki::cfg{Site}{Locale} = 'en_GB.UTF8';
$TWiki::cfg{UseLocale} = 1;
$TWiki::cfg{Site}{CharSet} = 'utf-8';

Note that FW 1.0 is more improved in handling special characters than in T 4.1.2, meaning, 4.1.2 doesn't allow me to upload at all, whilst 1.0 just strips off the characters.

-- KwangErnLiew - 04 Jan 2009

Confirmed. Foswiki::Sandbox::sanitizeAttachmentName uses $fileName =~ s/$Foswiki::cfg{NameFilter}//goi if UseLocale is on. This is set in the configuration:
# Filter-out regex for webnames, topic names, usernames, include paths
# and skin names. This is a filter <b>out</b>, so if any of the
# characters matched by this expression are seen in names, they will be
# removed.
$Foswiki::cfg{NameFilter} = qr/[\s\*?~^\$@%`"'&;|<>\[\]\x00-\x1f]/;
Thus the workaround is to extend that RE to work for your selected charset.

-- CrawfordCurrie - 06 Jan 2009

Already fixed in 1.2.

-- JozefMojzis - 24 Jun 2015

ItemTemplate edit

Summary Uploaded filename stripped if special character
ReportedBy Foswiki:Main.KwangErnLiew
SVN Range TWiki-4.2.3, Wed, 06 Aug 2008, build 17396
AppliesTo Engine
Component I18N
Priority Normal
CurrentState Closed
TargetRelease major
ReleasedIn 2.0.0
Topic revision: r6 - 05 Jul 2015, GeorgeClark
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy