convert ' ' -> '%20' and so on.
GD expects the name to be inside a url so we have to escape special chars