Skip Menu |
 

This queue is for tickets about the Encode CPAN distribution.

Report information
The Basics
Id: 111853
Status: resolved
Priority: 0/
Queue: Encode

People
Owner: Nobody in particular
Requestors: dwheeler [...] cpan.org
SREZIC [...] cpan.org
Cc: pali [...] cpan.org
AdminCc:

Bug Information
Severity: (no value)
Broken in:
  • 2.80
  • 2.81
  • 2.82
  • 2.83
Fixed in: (no value)



Subject: Encode >= 2.80 breaks HTML-DOM-0.055
Download (untitled) / with headers
text/plain 346b
See https://rt.cpan.org/Ticket/Display.html?id=111824 The test failures look like this: expected: # Content-Disposition: form-data; name="foo" got: # Content-Disposition: form-data; name="=?UTF-8?B?Zm9v?=" And while the got result is not exactly wrong, I don't think that utf-8+base64 should be used here where plain ascii would also work.
Download (untitled) / with headers
text/plain 490b
On 2016-02-07 12:50:50, SREZIC wrote: Show quoted text
> See https://rt.cpan.org/Ticket/Display.html?id=111824 > > The test failures look like this: > > expected: > > # Content-Disposition: form-data; name="foo" > > got: > > # Content-Disposition: form-data; name="=?UTF-8?B?Zm9v?=" > > > And while the got result is not exactly wrong, I don't think that utf- > 8+base64 should be used here where plain ascii would also work.
Also affected (possibly): https://github.com/theory/svn-notify/issues/14
Download (untitled) / with headers
text/plain 392b
On Ned Feb 07 12:50:50 2016, SREZIC wrote: Show quoted text
> The test failures look like this: > > expected: > > # Content-Disposition: form-data; name="foo" > > got: > > # Content-Disposition: form-data; name="=?UTF-8?B?Zm9v?="
This looks like a broken test. Name attribute in Content-Disposition header must be us-ascii, not MIME. So it looks like you try to MIME encode that attribute which is wrong.
Download (untitled) / with headers
text/plain 626b
On 2016-03-25 08:50:34, PALI wrote: Show quoted text
> This looks like a broken test. Name attribute in Content-Disposition > header must be us-ascii, not MIME. So it looks like you try to MIME > encode that attribute which is wrong.
Well, the SVN::Notify test failure referenced by SREZIC is: # Subject: =?UTF-8?Q?=5B111=5D_Did_this,_that,_and_the_=C2=ABother=C2=BB.?=' # # doesn't match '(?^:Subject: \[111\] \=\?UTF\-8\?Q\?Did_this\,_that\,_and_the_\=C2\=ABother\=C2\=BB\.\?\=\n)' Here's where it uses Encode to MIME-Q encode the subject and other headers: https://github.com/theory/svn-notify/blob/master/lib/SVN/Notify.pm#L1464
Download (untitled) / with headers
text/plain 955b
On Pia mar 25 18:52:53 2016, DWHEELER wrote: Show quoted text
> On 2016-03-25 08:50:34, PALI wrote: >
> > This looks like a broken test. Name attribute in Content-Disposition > > header must be us-ascii, not MIME. So it looks like you try to MIME > > encode that attribute which is wrong.
> > Well, the SVN::Notify test failure referenced by SREZIC is: > > # Subject: =?UTF- > 8?Q?=5B111=5D_Did_this,_that,_and_the_=C2=ABother=C2=BB.?=' > # > # doesn't match '(?^:Subject: \[111\] \=\?UTF\- > 8\?Q\?Did_this\,_that\,_and_the_\=C2\=ABother\=C2\=BB\.\?\=\n)'
This looks correct.. or where do you see problem? Show quoted text
> Here's where it uses Encode to MIME-Q encode the subject and other > headers: > > https://github.com/theory/svn- > notify/blob/master/lib/SVN/Notify.pm#L1464
Looks like that test try to encode whole "from" and "to" headers. That would produce incorrect email. Only phrase part(s) of "from" and "to" headers must be MIME encoded -- not email address itself.
CC: SREZIC [...] cpan.org, pali [...] cpan.org
Subject: Re: [rt.cpan.org #111853] Encode >= 2.80 breaks HTML-DOM-0.055
Date: Mon, 28 Mar 2016 10:32:58 -0700
To: bug-Encode [...] rt.cpan.org
From: "David E. Wheeler" <dwheeler [...] cpan.org>
Download (untitled) / with headers
text/plain 670b
On Mar 27, 2016, at 6:00 PM, Pali via RT <bug-Encode@rt.cpan.org> wrote: Show quoted text
> This looks correct.. or where do you see problem?
The test passed for like 8 years and suddenly started failing. Did something change in the MIME-Q encoder? Only change I see matching “MIME-Q" in Changes dates from 2009. I can probably change the test to use encode instead of its own regex. It’s just odd that it started breaking after all these years. Show quoted text
> Looks like that test try to encode whole "from" and "to" headers. That would produce incorrect email. Only phrase part(s) of "from" and "to" headers must be MIME encoded -- not email address itself.
Good to know, thanks. David
CC: bug-Encode [...] rt.cpan.org, SREZIC [...] cpan.org
Subject: Re: [rt.cpan.org #111853] Encode >= 2.80 breaks HTML-DOM-0.055
Date: Mon, 28 Mar 2016 19:40:37 +0200
To: "David E. Wheeler" <dwheeler [...] cpan.org>
From: pali [...] cpan.org
Download (untitled) / with headers
text/plain 956b
On Monday 28 March 2016 19:32:58 David E. Wheeler wrote: Show quoted text
> On Mar 27, 2016, at 6:00 PM, Pali via RT <bug-Encode@rt.cpan.org> wrote:
> > This looks correct.. or where do you see problem?
> > The test passed for like 8 years and suddenly started failing. Did > something change in the MIME-Q encoder? Only change I see matching > “MIME-Q" in Changes dates from 2009.
Yes, finally after years in Encode version 2.83 I fixed Encode::MIME::Header package to correctly encode and decode strings... Show quoted text
> I can probably change the test to use encode instead of its own > regex. It’s just odd that it started breaking after all these years.
Beware that parsing some of email headers is not easy by regexes... Show quoted text
> > Looks like that test try to encode whole "from" and "to" headers. > > That would produce incorrect email. Only phrase part(s) of "from" > > and "to" headers must be MIME encoded -- not email address itself.
> > Good to know, thanks. > > David
CC: SREZIC [...] cpan.org, pali [...] cpan.org
Subject: Re: [rt.cpan.org #111853] Encode >= 2.80 breaks HTML-DOM-0.055
Date: Mon, 28 Mar 2016 10:42:45 -0700
To: bug-Encode [...] rt.cpan.org
From: "David E. Wheeler" <dwheeler [...] cpan.org>
Download (untitled) / with headers
text/plain 625b
On Mar 28, 2016, at 10:41 AM, Pali via RT <bug-Encode@rt.cpan.org> wrote: Show quoted text
> Yes, finally after years in Encode version 2.83 I fixed > Encode::MIME::Header package to correctly encode and decode strings...
Actually, it already does that. The test sets up the subject like this: my $subj = "Did this, that, and the «other»."; my $qsubj; if (SVN::Notify::PERL58()) { $subj = Encode::decode_utf8( $subj ); $qsubj = quotemeta Encode::encode( 'MIME-Q', $subj ); } else { $qsubj = quotemeta $subj; } So I don’t understand why the test fails. Both the test and the code Q-encode the UTF-8 subject. Best, David
CC: bug-Encode [...] rt.cpan.org, SREZIC [...] cpan.org
Subject: Re: [rt.cpan.org #111853] Encode >= 2.80 breaks HTML-DOM-0.055
Date: Mon, 28 Mar 2016 19:51:02 +0200
To: "David E. Wheeler" <dwheeler [...] cpan.org>
From: pali [...] cpan.org
Download (untitled) / with headers
text/plain 762b
On Monday 28 March 2016 19:42:45 David E. Wheeler wrote: Show quoted text
> On Mar 28, 2016, at 10:41 AM, Pali via RT <bug-Encode@rt.cpan.org> wrote:
> > Yes, finally after years in Encode version 2.83 I fixed > > Encode::MIME::Header package to correctly encode and decode > > strings...
> > Actually, it already does that. The test sets up the subject like > this: > > my $subj = "Did this, that, and the «other»."; > my $qsubj; > if (SVN::Notify::PERL58()) { > $subj = Encode::decode_utf8( $subj ); > $qsubj = quotemeta Encode::encode( 'MIME-Q', $subj ); > } else { > $qsubj = quotemeta $subj; > } > > So I don’t understand why the test fails. Both the test and the code > Q-encode the UTF-8 subject. > > Best, > > David
And what does that test compare?
CC: SREZIC [...] cpan.org
Subject: Re: [rt.cpan.org #111853] Encode >= 2.80 breaks HTML-DOM-0.055
Date: Mon, 28 Mar 2016 10:53:57 -0700
To: bug-Encode [...] rt.cpan.org
From: "David E. Wheeler" <dwheeler [...] cpan.org>
Download (untitled) / with headers
text/plain 207b
On Mar 28, 2016, at 10:51 AM, Pali via RT <bug-Encode@rt.cpan.org> wrote: Show quoted text
> And what does that test compare?
The failing test: like( $email, qr/Subject: \[111\] $qsubj\n/, "Check subject" ); David
RT-Send-CC: pali [...] cpan.org
Download (untitled) / with headers
text/plain 348b
On Mon Mar 28 13:54:05 2016, DWHEELER wrote: Show quoted text
> On Mar 28, 2016, at 10:51 AM, Pali via RT <bug-Encode@rt.cpan.org> wrote: >
> > And what does that test compare?
> > The failing test: > > like( $email, qr/Subject: \[111\] $qsubj\n/, "Check subject" ); > > David > >
Hi! Ideally post me whole test as I still do not see what there happen...
CC: SREZIC [...] cpan.org
Subject: Re: [rt.cpan.org #111853] Encode >= 2.80 breaks HTML-DOM-0.055
Date: Tue, 29 Mar 2016 09:28:50 -0700
To: bug-Encode [...] rt.cpan.org
From: "David E. Wheeler" <dwheeler [...] cpan.org>
Download (untitled) / with headers
text/plain 291b
On Mar 29, 2016, at 1:42 AM, Pali via RT <bug-Encode@rt.cpan.org> wrote: Show quoted text
> Hi! Ideally post me whole test as I still do not see what there happen...
Probably easiest just to clone and run: git clone https://github.com/theory/svn-notify.git cd svn-notify prove -lv t/base.t Best, David
Download (untitled) / with headers
text/plain 426b
On Uto mar 29 12:29:02 2016, DWHEELER wrote: Show quoted text
> On Mar 29, 2016, at 1:42 AM, Pali via RT <bug-Encode@rt.cpan.org> wrote: >
> > Hi! Ideally post me whole test as I still do not see what there happen...
> > Probably easiest just to clone and run: > > git clone https://github.com/theory/svn-notify.git > cd svn-notify > prove -lv t/base.t > > Best, > > David >
This this patch: https://github.com/theory/svn-notify/pull/15
Download (untitled) / with headers
text/plain 152b
So problem was in svn-notify (now fixed), not in Encode::MIME::Header. And I bet same would be also for HTML-DOM-0.055: incorrect usage of MIME-Header.
Bug for HTML-DOM is now closed, so close also this one.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.