Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Customising the CMS /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

How to allow multibyte characters in the names of uploaded files?


Go to End


3 Posts   772 Views

Avatar
Jare

Community Member, 39 Posts

13 April 2017 at 8:11pm

Hi,

I know how to enable multibyte characters in URL segments (via the configuration of the URLSegment class), but doing that has no effect on uploaded file names. If they contain multibyte characters, they will be transliterated. For example, an image file name Pääsiäinen.jpg (a Finnish word meaning Easter) becomes Paeaesiaeinen.jpg, because ä is not simply transliterated to a, but to ae instead. The current result is just really hard to read :D.

So it would be best to be able to keep the file name intact, but another good solution would be to modify the transliteration process so that ä would become a.

Thanks for your support! :)

Avatar
Devlin

Community Member, 344 Posts

19 April 2017 at 12:54am

https://api.silverstripe.org/3.1/class-FileNameFilter.html

To leave uploaded filenames as they are (being aware of filesystem restrictions), add the following code to your YAML config:

FileNameFilter:
  default_use_transliterator: false
  default_replacements:

Avatar
Jare

Community Member, 39 Posts

25 April 2017 at 10:25pm

Thank you very much! I will try it out next time when I'm going to do some work with attachments.