ICE-11494 added functions to efficiently encode special characters in the file name portion of the resource path, so that resources that contain special characters can be downloaded (to the EE 3.3 maintenance branch)
Because of the reasons described in
ICE-11484, it wasn't possible to apply the encoding only to the file name, before it was registered. Trying to do this from the component class resulted in including the % encoding characters in the downloaded filename, because that's how the resource was registered on the framework. So, this solution takes the resource path and extracts the filename portion and escapes all special characters, and inserts it back in the resource path, replacing the old file name, in order to form a valid URL.
Note that while all special characters are correctly escaped now, some special characters may be illegal in some operating systems, which results in the OS replacing those special characters for a safe characters. For example, on Windows, all these characters / \ " * : < > ? | ~ are replaced by underscores when saved to the file system.