Actually combined the Mac and Linux invalid chars logic this time.