[imp] Folder names with tilde character

Jens Wahnes wahnes at uni-koeln.de
Wed Nov 18 18:17:51 UTC 2015


One of our users created a folder with a tilde ("~") character within 
the folder name.  This kind of folder name is not handled correctly. 
When the folder is shown in the folder list, the tilde character is 
silently dropped.  For instance, if a folder by the name of "~tilde~" is 
created, it is shown in the mailbox list as if it were called "tilde". 
As a result, all kinds of bad things happen, e.g. when trying to open 
the folder, an error message is shown, as there is no folder named just 
"tilde" present on the server.

I have seen this happening on a server without UTF-8 support (RFC 6855). 
  Since I don't have access to any IMAP server that does support the 
"UTF8=ACCEPT" extension, I don't know if it happens on those servers as 
well.  Maybe someone else can try to see what happens there?

After a very long search, I found out that this problem is caused by the 
code in the Horde_Imap_Client_Tokenize class, or more precisely the code 
within the "next" method on line 292 or so.  There is a comment attached 
to the "case" statement in question which reads "Ignore binary string 
identifier. PHP strings are binary-safe", but even after reading quite a 
bit of the surrounding code, I fail to understand what is meant by that 
comment.  The only other location I found which seems to deal with this 
is on line 209 or so, in the getLiteralLength method.

Disabling the code that sorts out tilde characters around line 292 of 
Tokenize.php sure does help to resolve the problem of folder names with 
a tilde character being displayed incorrectly in IMP.  AFAICT, this does 
no harm to folder names that do in fact contain "binary" characters such 
as "Äpfel ≠ Birnen".  However, I'm not really sure if this kind of 
change might still have side effects that I cannot foresee.  Maybe 
someone more familiar with the Horde_Imap_Client code can tell if it is 
safe to disable that particular piece of code?


Jens


-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4986 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.horde.org/archives/imp/attachments/20151118/38bb82fb/attachment.bin>


More information about the imp mailing list