[Python-bugs-list] imaplib select function string handling (PR#336)

alian@trakus.com alian@trakus.com
Sun, 21 May 2000 15:42:24 -0400 (EDT)

Full_Name: Alexander Lian
Version: 1.5.2
Submission from: (NULL) (

I'm sure this bug is due to my odd usage.
I've been using the imaplib to access a Notes server (4.6.6a)
and noticed a string handling oddity with the select function.

In Lotus Notes, mailbox hierarchy utilizes a '\' as their
string delimiter. Thus, a sub folder 'bar' of folder 'foo' will
list as 'foo\bar'.

The bug manifests itself if there is a space in any mailbox name
regardless of hierarchy.

Normally, in such a case of 'a\\b\\c', the select function works

However, if the mailbox lists from the list function as:
'a\\b c' 
then the select function fails with that exact string.

Instead, it functions correctly by replacing the '\\' with '\\\\'
(of course, when actually adding that it's eight slashes)

So it seems the name is getting string mangled twice to go from '\\\\'
down to the IMAP specified single character, in this case '\'.

I'm guessing this bug may manifest in other functions, but I have
not determined that as of yet.