Thread (39 messages) flat view 39 messages, 6 authors, 2016-06-15

Re: [PATCH RFC3.5 08/12] send-email: Move Subject sanitization from --compose code to send_message

From: Michael Witten <hidden>
Date: 2016-06-15 22:46:37

On Sun, Apr 19, 2009 at 09:13, Jay Soffian [off-list ref] wrote:
I think I was not clear. My suggestion was to move the /[^[:ascii:]]/
check to the inside of quote_rfc2047 exactly so that it doesn't always
change its input. i.e.
Ah. However, there is still the question of whether the actual email
headers are present to declare the right encoding. I don't know enough
to comment on this, though; before this patch, this quoting was
performed by code that new to right the correct "Content-Type" and
"Content-Transfer-Encoding" headers. I suppose I'll have to read the
RFC.
quoted
       sub quote_rfc2047 {
               local $_ = shift;
Add this:
                return $_ unless /[^[:ascii:]]/;
quoted
               my $encoding = shift || 'utf-8';
               s/([^-a-zA-Z0-9!*+\/])/sprintf("=%02X", ord($1))/eg;
               s/(.*)/=\?$encoding\?q\?$1\?=/;
               return $_;
       }
This simplifies things for the function caller I think.
I'm morally opposed to this kind of thing. The caller should be
required to test whether quote_rfc2047() is required, as it's not the
job of quote_rfc2047 to validate. Suppose that quote_rfc2047 were
actually part of a library of useful functions that my program
imports. Perhaps my program knows that it must always quote some piece
of text. Why, then, should my program be forced to waste the cycles to
perform a useless test?

IMnsHO, verification should always be done by the caller with one
exception: Interactive (human) input should always be verified,
because humans represent an unreliable component in the system (in
terms of digital systems, their asynchronous input must be
synchronized with the clocked system). WIth this model, there's are
fewer wasted cycles, because you can reuse verification across similar
functions, and the code (particularly library code) is easier to
understand.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help