[Dovecot] Sieve, vacation, variables and russian language
Folks,
I'm using a Sieve script for vacation messages and there's something strange with it in certain cases.
The script uses the "variables" extension to produce the "Re: [original subject] (autoreply)" subject line for the vacation message.
All is well except for cases when that [original subject] is written in Russian.
In those cases the subject string is garbled, and the Amavis content filter says
"X-Amavis-Alert: BAD HEADER SECTION, Non-encoded 8-bit data (char D0 hex):Subject: RE: \320\277\321?\320\276\320\261\320\260 (Auto[...]"
It doesn't complain about English subject strings, though.
I've seen the thread about "Sieve vacation with russian subject" at http://www.dovecot.org/list/dovecot/2009-July/041031.html ,
but that wasn't quite a solution.
I can't figure out how to work around that, could anyone help out please?
Mandatory info:
FreeBSD 7.2 i386, dovecot 1.2.3, dovecot-sieve-1.2+0.1.11
And here's the script itself:
require ["fileinto", "vacation", "variables"];
set "subject" "";
if header :matches "subject" "*" {
set "subject" "${1}";
}
vacation :days 1 :subject "RE: ${subject}"
"[vacation message text]";
P.S. Stephan Bosch, thank you very much for what you've done with sieve.
On Sat, 2009-09-12 at 01:59 +0400, Sergey Grigorian wrote:
The script uses the "variables" extension to produce the "Re: [original subject] (autoreply)" subject line for the vacation message.
All is well except for cases when that [original subject] is written in Russian.
This is a TODO item:
- Vacation: the ":subject" parameter specifies a subject line to attach to
any vacation response that is generated. UTF-8 characters can be used in
the string argument; implementations MUST convert the string to [RFC2047]
encoded words if and only if non-ASCII characters are present.
I think the main reason this hasn't been implemented yet is that this conversion isn't required anywhere else in Dovecot. So the first step would be to create RFC 2047 encoder for Dovecot. Feel free to implement one. :)
On Fri, 11 Sep 2009 18:05:34 -0400, Timo Sirainen tss@iki.fi wrote:
On Sat, 2009-09-12 at 01:59 +0400, Sergey Grigorian wrote:
The script uses the "variables" extension to produce the "Re: [original subject] (autoreply)" subject line for the vacation message.
All is well except for cases when that [original subject] is written in Russian.
This is a TODO item:
- Vacation: the ":subject" parameter specifies a subject line to attach to any vacation response that is generated. UTF-8 characters can be used in the string argument; implementations MUST convert the string to [RFC2047] encoded words if and only if non-ASCII characters are present.
I think the main reason this hasn't been implemented yet is that this conversion isn't required anywhere else in Dovecot. So the first step would be to create RFC 2047 encoder for Dovecot. Feel free to implement one. :)
Oh well. Should've read the TODO with more attention. Thanks a lot, it all is clear now. Honestly, I suck at implementing, but might give it a try (if nobody more able will do that, that is). :)
On Fri, 2009-09-11 at 18:05 -0400, Timo Sirainen wrote:
I think the main reason this hasn't been implemented yet is that this conversion isn't required anywhere else in Dovecot. So the first step would be to create RFC 2047 encoder for Dovecot. Feel free to implement one. :)
Well, I actually spent some time writing the code anyway. Not tested at all currently. I started writing unit tests but it didn't get very far. I'm not really sure what kind of decisions I should use to figure out where to start/end the encoded words or when to use base64 instead of q-p. Currently it uses:
- if only one word has non-ascii, encode only that word. otherwise encode the whole string.
- if more than 1/3 of string has non-ascii characters, use base64.
Attached a patch for it. Of course you'd still need to change Sieve to use it.
participants (3)
-
Sergey Grigorian
-
sg@theconcept.ru
-
Timo Sirainen