[Mimedefang] Rejecting Cyrillic

Jan Pieter Cornet johnpc at xs4all.nl
Fri Apr 17 05:16:14 EDT 2009


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 <johnpc at xs4all.nl>
!! 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.  !!



More information about the MIMEDefang mailing list