From: <no...@tc...> - 2025-05-19 09:33:58
|
Automated mail by fx, on behalf of no...@tc... Ticket Change [a3ac593dfa35367025764364e1cedba29dc72b1fd0263e57042582c4577ee511] [mime::field_decode remove spaces in specific situations] By anonymous For Tcllib On 2025-05-19T09:28:02.529 Details https://core.tcl-lang.org/tcllib/tinfo?name=a3ac593dfa35367025764364e1cedba29dc72b1fd0263e57042582c4577ee511 Ticket https://core.tcl-lang.org/tcllib/tktview/d3f66f9a756f54569caf57bbb2cade1f3d25ad06 Changed Fields assignee: nobody closer: nobody comment: Example from a newsletter: Subject: =?UTF-8?Q?Neuer_SPD-Generalsekret=C3=A4r_?= =?UTF-8?Q?Kl=C3=BCssendorf_warnt_Union_vor_?= =?UTF-8?Q?Konflikt_bei_Migration?= puts [::mime::field_decode [::mime::getheader $mime_data "Subject"]] results in "Neuer SPD-GeneralsekretärKlüssendorf warnt Union vorKonflikt bei Migration" it should be "Neuer SPD-Generalsekretär Klüssendorf warnt Union vor Konflikt bei Migration" Note that the whitespace is part of the encoded word. A quick-fix for me (may break some other case) was to switch order while decoding: @@ -2537,18 +2537,18 @@ proc ::mime::qp_decode {string {encoded_word 0}} { # 8.1+ improved string manipulation routines used. # Special processing for encoded words (RFC 2047) - - if {$encoded_word} { - # _ == \\x20, even if SPACE occupies a different code position - set string [string map [list _ \\u0020] $string] - } - + # smash the white-space at the ends of lines since that must've been # generated by an MUA. regsub -all -- {[ \ ]+\ } $string \ string set string [string trimright $string " \ "] + if {$encoded_word} { + # _ == \\x20, even if SPACE occupies a different code position + set string [string map [list _ \\u0020] $string] + } + # Protect the backslash for later subst and # smash soft newlines, has to occur after white-space smash # and any encoded word modification. foundin: 1.20 is_private: 0 login: anonymous priority: 5 Medium resolution: None severity: Minor status: Open submitter: anonymous subsystem: mime title: mime::field_decode remove spaces in specific situations type: Bug ------------------------------------------------------------ See Tcl/Tk development @ http://core.tcl-lang.org/ ------------------------------------------------------------ |