There isn't enough info here to know where the bug lies for sure. A
good test case and data are called for. Based on my test I would guess
this is a server bug. Here's my test code:
#!/usr/bin/perl
use warnings;
use strict;
use Data::Dumper qw(Dumper);
use Mail::IMAPClient ();
my $imap = Mail::IMAPClient->new(
server => 'my.server',
User => 'myuser',
Password => 'mypass',
Debug => 1,
) or die("error connecting to server: $@");
my $folder = '20% discount';
#$imap->create($folder) or die("create '$folder': $@\n");
$imap->select($folder) or die("select '$folder': $@\n");
my $folders = $imap->folders;
print "folders: ", Dumper($folders);
#$imap->delete($folder) or die("delete '$folder': $@\n");
In my case I used an empty mailbox so I created and deleted the mailbox
(code commented out above). In the debug output I see:
Sending: 2 CREATE "20% discount"
Sent 25 bytes
Read: 2 OK Create completed.
Sending: 3 SELECT "20% discount"
Sent 25 bytes
...
Sending: 4 LIST "" *
Sent 13 bytes
Read: * LIST (\NoInferiors \UnMarked) "/" "afolder"
...
* LIST (\NoInferiors \UnMarked) "/" "20% discount"
...
* LIST (\NoInferiors \UnMarked) "/" "INBOX"
4 OK List completed.
Notice the server doesn't escape the '%'.
In RFC3501 I don't see why a server would/should escape a '%', I see:
quoted-specials = DQUOTE / "\"
That's it. Marking this bug as rejected for now.