1

I am trying to mark all messages that use either chinese characters or cyrilic (russian) characters for deletion, since to me, they are all spam.

2

You can filter on the encoding foo with: ~h^content-type:.*foo

However this is rather limited. First, messages using specific characters (Chinese characters, Cyrillic...) can be encoded in UTF-8. Moreover, for messages that have attachments, the encoding is specified in headers of MIME attachments, and from the point of view of Mutt's patterns, this is the body; you can still use ~Bfoo, but it will be slow and you may have false positives (you can't include content-type because attachment headers may be on several body lines).

There may be external tools that can identify the script, but that's no longer related to Mutt...

If this is for spam filtering, Bayesian filters may be good for this kind of things (without needing to know what script it is).

You can also filter on the presence of some characters belonging to a specific script: see Use regular expression to match ANY Chinese character in utf-8 encoding. This doesn't work in Mutt yet (perhaps in the future), but external tools could be used in the mean time.

It's also possible to filter without decoding first (this is faster). For instance, I currently filter some Russian spam in postfix with the following pcre regex (case sensitive):

/^Subject:\s*"?=\?[Uu][Tt][Ff]-8\?[Bb]\?(0[J-Z]|(KN|W9)[C-R])/i
  • I would like to mark the message if even a single chinese or cyrillic character appears. Even if it uses UTF-8 encoding, there ought to be a way to do this; I guess these characters are in particular ranges. – dbkeys Oct 9 '14 at 11:37
  • @dbkeys Answer edited. Perhaps you can find other methods via a search on keywords like: chinese utf8 regex script, and also "chinese spam" / "russian spam". – vinc17 Oct 9 '14 at 15:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.