#821: Referrer check breaks with UTF-8 URLs

I tried to do as simple as possible. Let me know what you think.