On Thu, Apr 16, 2009 at 10:37:33PM -0400, Kevin A. McGrail wrote:
> Richard,
> 
> I've been looking at this and the code seems to work but I wonder if you 
> can't achieve the same result with just a regexp:
> 
> if ($Subject =~ /=\?(koi8-r|Windows-1251)\?/i) {
> }

No. At least, not if you actually care about legitimate email.

The problem is that english only uses ascii, and ascii is a subset of
practically every other character set. So someone writing in cyrillic
and using koi8-r or windows-1251, won't switch to another character set
when answering a question on, for example, this mailinglist, using only
ascii characters to write english.

The test used by Richard Laager is the only correct way to do this:
first convert to unicode, then test to see if there are "illegal"
characters present.

-- 
Jan-Pieter Cornet <[email protected]>
!! Disclamer: The addressee of this email is not the intended recipient. !!
!! This is only a test of the echelon and data retention systems. Please !!
!! archive this message indefinitely to allow verification of the logs.  !!
_______________________________________________
NOTE: If there is a disclaimer or other legal boilerplate in the above
message, it is NULL AND VOID.  You may ignore it.

Visit http://www.mimedefang.org and http://www.roaringpenguin.com
MIMEDefang mailing list [email protected]
http://lists.roaringpenguin.com/mailman/listinfo/mimedefang

Reply via email to