Fixing charCodeAt for Chrome and Safari