UTF-8 support / Perl regex \p{} unicode character property in 4.0.x
Jona Müller <[email protected]> Wed, 25 Mar 2026 10:47:06 +0100
| Newsgroups | gmane.mail.spam.spamassassin.general |
|---|---|
| Message-ID | <acOvGv2No3mOXaTr@MacbookPro> |
Hello everyone,
we use SA together with amavis and postfix. As a lot of spam and scam mail has
emojis in the subject and more importantly the friendly from we use custom rules
to assign a bit of score to it (a lot of legitimate mail has emojis these days
so there is no emoji => spam causation).
However, that currently means writing regex for the raw UTF-8 byte sequences,
which look like this (at least, only gets less readable from here):
/\xF0\x9F[\x98-\x99\xA4-\xA7\x8C-\x97][\x80-\x8F]|\xE2\x98[\xB9-\xBB]/
It has already been discussed in this thread
https://lists.apache.org/thread/mwqhy9b78t73p4zovgbmz283hns4mxvh
With the conclusion that the strings need to be UTF-8 internally
(normalize_charset 1). The thing is this was already 5 years ago and my question
is: Has the situation changed? \u{} and \p{} didnt bite when I tried it,
although it works on the same machine when I try it with the same perl in a
script.
How can I achieve that in 4.0.x? At least for headers - that are written in
encoded word syntax for UTF-8:
Subject: =?UTF-8?Q?...?=
The documentation for the body explicitly states that \p{} is not supported but
this has been there for a long time (outdated?).
Maybe with a header eval method?
header SYMBOLIC_TEST_NAME eval:name_of_eval_method([arguments])
Please let me know if you have any suggestions how to tackle this. I dont need
it to be the upstream default, just getting it to work is enough if someone just
gives me some insights how the internals work on this. (Meaning why exactly does
\p{} not work).
Dont take this the wrong way, but I really would like to start using handy perl
features from 2012 and not continue to flip bits in the binary calculator with
five tabs of unicode code pages open. Especially because they change every year.
Thank you.
ys,
Jona Müller
--
================================
Independend GmbH
[email protected]
+49 6832 265556
http://ind.me
(unnamed)
(application/pgp-keys, 6.3 KB) - not displayed
signature.asc
(application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEM0qOw5hydnArKgH2jALoLo7pDpwFAmnDrxYACgkQjALoLo7p DpwfiRAAsGFyW1GP+C7Df3VMvnTQ/PJGdlV7ewIuq/mT9BJRhta1TFkDSHVx0xE5 qwuzGyqVeUJ6m26wveTELw3N4270djsbkQGzeaqdlMNRre2BSKi+dVAgHVHnCiAr 6aWnXd7SH3jYZ+aUmRUbBuW90lO6G/EHkWyxHnLb/M5uoi1wMOTY1bvb00pwby54 1/AT7OsC56R6oJwr2rkzVe70zwTtXMfMsuQc27MpXI6SGIDfO33BRkR3gIwTZSck xAXRVU4FXuoVbPMBjUpD0sQqpiCdtsnVNvlcGoMPnhOlUUfZwXmnkkMO7GIU3tS4 OJieOBOIbDZk4eq2RrSQ1XaumGiySfJsybQghNyH6sjuYy4m2Ytxdp9oee/kdOAZ 9x/UBb+Rfu63AmJfmlS8H2ljlh5m92WjPOun+UMKrhKy63kxAqHQY8QhJMUtfPdn xy7yBRBZy9/LmiU4q0raTWy5erk81O4NbxP5YJOwdu1Oo5/S/+x1ooMRGwu0a+lc ccXsfczPk0/8on2GYB5BGZrYmGdAUmHcMOxA6R443k/9YeOnNq8X8wz8E9DmW/yE gLXu/2a+uS+s4vblvI1NCmpoLb6nhvMyVVx2Io6m+44Un7DYgnxFqqDCSDDQmUUl c5GC193JCryZNHS0YVChdKVU8wiDOZx4YRQKNpskcPBW3hILwb4= =/nTE -----END PGP SIGNATURE-----