Mardi mai 26, 2020

How to handle special characters in filenames using Switch

Rubriques : Tips and Tricks

There are many cases where filenames can generate problems, especially between different operating systems (e.g. Mac or Windows) or when transferring files to a webserver. In particular, spaces, special characters, or diacritics in filenames can be wrongly translated or even avoid file saving.

What is a diacritic?

Even if you never heard about the name, you surely dealt with diacritics before. A diacritic is a glyph added to a letter that somehow alters its pronunciation and which appears above, below, within or between letters — French uses five diacritics: the grave, acute, and circumflex accents, as well as the cedilla and dieresis.

Filename Cleaner Pro is a Switch app that will clean your filenames, in an easy way.

Scenario 1: make a clean and readable URL

Sometimes, URL are very difficult to read because of spaces or special characters in the name, as these characters have to be escaped to be compatible with web standards. This makes URL very difficult to read (at best) or makes it impossible to download the file!

As you can see in the example below, the URL is not easy to read… but even, the webserver cannot find the file, as the special characters in the filename have been wrongly converted, due to different character encoding.

If you want to get rid of this issue, the best is to avoid using diacritics, spaces, reserved characters, etc., but this takes quite some time to rename the files, and there is a chance that you forget about one.

Configure Filename Cleaner Pro just like below and all your files will be renamed in a way that they will not cause errors anymore:

In this case, the filename will be converted to lowercase, all diacritics will be replaced by their equivalent without alteration, the spaces will be replaced by a dash, and the reserved/special characters will be discarded.

Our file, named « Voix ambiguë d'un cœur qui au zéphyr préfère les jattes de kiwis.pdf » will be renamed « voix-ambigue-dun-coeur-qui-au-zephyr-prefere-les-jattes-de-kiwis.pdf ».

The URL is now easier to read, and the filename will not cause any issue anymore.

You can configure a Switch flow where all files dropped in the input folder will be renamed according to the setting above, transferred via FTP to the web server and send an email with the URL of the file (with its new name), so you can easily send the link to someone else.

Scenario 2: transfer files between platforms

The different platforms (e.g. Mac or Windows) are using different character encoding (e.g. MacRoman or ISO-8859-1) and have different forbidden characters. For example, “\” is allowed in a filename on Mac, but is forbidden on Windows (as this is the separator for sub-folders). Cleaning filenames to avoid transfer errors, or simply to have identical names on all workstations or servers of an organization, regardless of which type they are, would need users’ manual renaming, taking time and introducing risk in the renaming process (typos, forgotten characters, etc.).

Here again, adding a Filename Cleaner Pro module in your Switch flow before file transfer or archive can solve this issue. In that case, we will configure it, just to convert diacritics and replace reserved characters by an underscore (or any combination that would do it for you):

In case you have issues with the length of your filename, you can also add a truncation during the renaming process to handle this in one process. Filename Cleaner Pro can truncate from the beginning of the name (enter a positive number) or from the end (enter a negative number).

How to get back to the original filename

Filename Cleaner Pro offers two specific settings to remember the original filename, using private data and/or using XMP. While the first will allow to retrieve the original filename later in a Switch flow, the latter will embed the original filename as XMP into the file itself (typically graphic, audio and video files can embed XMP, e.g. PDF, TIFF, PNG, MP4, etc.). That means that you will be able to retrieve the original filename, even if the file has been transferred to many systems, downloaded, or even modified.

Don't want to miss anything? Subscribe now!

Subscribe to our monthly newsletter and get the latest Enfocus articles delivered to your inbox.

(*) Required field. By submitting this form, you confirm that you have reviewed and agree with the Enfocus general terms, conditions, EULA and privacy policy.

About Christian Blaise

christian blaise photo

Christian Blaise has 30 years of experience in the Graphic Arts industry. With his in-depth knowledge of the graphic supply chain market and his strong technical and technological expertise, he is one of the most recognized experts of the market. His original background (pre-press and printing production, brand owner and graphic solutions vendor) allows him to have the most global view possible of the graphic chain and to understand the needs and expectations of all the players in the chain.

Christian runs agileStreams, a consulting company specialized in project management and automation, and has held several roles at Nestlé, Enfocus, Gap Systems and Société Alsacienne d’Aluminum (now Amcor). He is Marketing Officer of the Ghent Workgroup where he also serves as co-chairman of the Packaging & the Cross-Media SubCommittees.

En savoir plus sur :