What's not easy is to determine what the new filename should be. There are several factors we should take care of:
- Character encoding of the file system. This may be specified by the current locale, but also you should be able to override it. For example, your current locale is UTF8 but you only want to write 7-bit ASCII to support transferring files to devices with no UTF8 support.
Then there is this issue of converting unicode to 8 bit character encodings. Some combined characters in unicode may not have a equivelant character in the target encoding, but in decomposed form they may (for example the character "ë").
- Characters that have a special meaning in shells should be removed.
- Simplify white space usage.
- Optionally substitute any spaces for underscores.
- Optionally only use lower case characters.
- Optionally only use lower case characters for the file extension.