On Sunday 18 June 2006 03:17, Uoti Urpala wrote:
The current version seems questionable in a couple of ways. It replaces "unsafe" characters with '_', but the resulting filename isn't stored anywhere and it seems that such files are unlikely to ever be successfully loaded by anything after they've been saved on disk (fontconfig won't find fonts after the name has been changed etc), so you could just as well skip saving them. The utf-8 decoding also seems unnecessary and could allow bytes with high bit set in filenames even though the code now tries to disallow that (the decoding doesn't check for nonstandard longer-than-normal representations so you could encode a small character with a long utf-8 sequence having high bits set).
The purpose of this code is to generate a valid file name most closely resembling the original one. Just for humans. Fontconfig matches fonts based on their properties like family and weight, ignoring the file name. Maybe it would be better to name them like 1.ttf, 2.ttf. After all, mplayer is not a tool for attachment extraction. In that case there is no need to keep old fonts, and we can use temporary files. No need for this portable filename validation code.