Mailing List Archive
tlug.jp Mailing List tlug archive tlug Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]Re: [tlug] Do you whitelist or blacklist utf-8? [SOLVED]
- Date: Thu, 24 Feb 2011 19:55:54 +0900
- From: Dave M G <dave@example.com>
- Subject: Re: [tlug] Do you whitelist or blacklist utf-8? [SOLVED]
- References: <4D639689.1010302@example.com> <4D63EFBC.1020900@example.com> <4D64C5DD.1040607@example.com> <4D64CB49.10906@example.com> <4D652AF5.10304@example.com> <4D655712.1090608@example.com> <37687.61.213.3.170.1298510044.squirrel@example.com> <4D661A15.8010009@example.com> <AANLkTikCD+G4k1J58UTfns8VEr=ipHgn+vaEVLsy8RUJ@example.com>
- User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.13) Gecko/20101208 Thunderbird/3.1.7
TLUG, Thanks to everyone for the advice. I think I've got to a place where I'm comfortable I'm filtering the right things. There might be some evolution in how I handle things, but the essential issue of whitelisting and blacklisting characters seems to be resolved. If anyone notices any problems with what I'm doing, by all means please tell me. In PHP: function hasNoBlacklistedCharacters($string) { // Return TRUE to say "no blacklisted characters". // Death to unwanted spacing characters! return !preg_match('/[\t\n\r\a\e\f\v]/', $string); } function hasOnlyWhitelistedCharacters($string) { // return TRUE to say "only whitelisted characters" return preg_match('/^[\p{L}\p{N}\p{Z}.@example.com/u', $string); } In Javascript: function hasOnlyWhitelistedCharacters(string) { // Seems to whitelist utf-8 character ranges even // though Javascript doesn't do nice utf-8 support // like PHP does. var whitelist = /^[\w \u00C0-\uDFFF\uF900-\uFFFF]*$/; return whitelist.test(string); } function hasNoBlacklistedChars(string) { // Death to evil spaces! var blacklist = /[\t\n\r\a\e\f\v]/'; return ! blacklist.test(string); } -- Dave M G
- Follow-Ups:
- Re: [tlug] Do you whitelist or blacklist utf-8? [SOLVED]
- From: Raymond Wan
- Re: [tlug] Do you whitelist or blacklist utf-8? [SOLVED]
- From: Peter Brandt
- References:
- [tlug] Do you whitelist or blacklist utf-8?
- From: Dave M G
- Re: [tlug] Do you whitelist or blacklist utf-8?
- From: Shmuel Fomberg
- Re: [tlug] Do you whitelist or blacklist utf-8?
- From: Dave M G
- Re: [tlug] Do you whitelist or blacklist utf-8?
- From: Shmuel Fomberg
- Re: [tlug] Do you whitelist or blacklist utf-8?
- From: Dave M G
- Re: [tlug] Do you whitelist or blacklist utf-8?
- From: Shmuel Fomberg
- Re: [tlug] Do you whitelist or blacklist utf-8?
- From: Nikolay Elenkov
- Re: [tlug] Do you whitelist or blacklist utf-8?
- From: Darren Cook
- Re: [tlug] Do you whitelist or blacklist utf-8?
- From: Josh Glover
Home | Main Index | Thread Index
- Prev by Date: Re: [tlug] Do you whitelist or blacklist utf-8?
- Next by Date: Re: [tlug] Do you whitelist or blacklist utf-8? [SOLVED]
- Previous by thread: Re: [tlug] Do you whitelist or blacklist utf-8?
- Next by thread: Re: [tlug] Do you whitelist or blacklist utf-8? [SOLVED]
- Index(es):
Home Page Mailing List Linux and Japan TLUG Members Links