[Koha-bugs] [Bug 21874] Umlauts broken in list email subjects

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Fri Nov 23 09:37:42 CET 2018


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21874

--- Comment #10 from Marcel de Rooy <m.de.rooy at rijksmuseum.nl> ---
(In reply to Katrin Fischer from comment #9)
> Trying to pinpoint the difference. The queue emails have this:
> 
> 1286     my $utf8   = decode('MIME-Header', $message->{'subject'} );
> 1287     $message->{subject}= encode('MIME-Header', $utf8);
> 1288     my $subject = encode('UTF-8', $message->{'subject'});
> 
> The shelf has:
> 
>  114     # Analysing information and getting mail properties
>  115     if ( $template_res =~ /<SUBJECT>(.*)<END_SUBJECT>/s ) {
>  116         $mail{'subject'} = Encode::encode("UTF-8", $1);
>  117         $mail{subject} =~ s|\n?(.*)\n?|$1|;
> 
> 
> Wonder if the encode('MIME-Header'... is the magical difference?

This is very nasty code. Minefield (mime..mine :)
Lines 1286 and 1287 are obscure. An undocumented tric to decode/encode. Weird
that it works. My first thought would be: $message->subject is from the
database and is in perl internal format, not in MIME encoding. The decode does
not result in utf8 so the var name is a bad choice(!). Should not do very much?
The line 1287 encodes to MIME. Line 1288 is weird after encoding to MIME.

Using still Mail::Sendmail with all its limitations in encoding etc. is another
pitfall.

So we should not be too hasty here. But all this encoding/decoding before
calling sendmail should be moved away to one single testable module and no
leftovers in several scripts.

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are watching all bug changes.


More information about the Koha-bugs mailing list