Fix translating of illegal characters on Windows (issue #6972).