The only place where we would need to *parse* a literal8, is when reading BODY data of a part. I think we always try to do this, but IIRC the server only has to send literal8 when the data both 1) is 8bit an 2) contains NULs. So you would have to artificially create that kind of data to possibly receive the correct response.

Regardless, UTF8 support isn't useful for testing since it only defines literal8 for sending data in APPENDS (thus, no local parsing needed).

It's going to be much easier to write a unit test for this. I'm almost 100% positive there's a unit test dedicated to tokenization of server response strings. So test that these two strings are parsed correctly:

* 1 FETCH (BINARY[1] ~{1}
and
* LIST () "" "~foo"

michael


Quoting Jan Schneider <j...@horde.org>:

Zitat von Michael M Slusarz <slus...@horde.org>:

Quoting Jens Wahnes <wah...@uni-koeln.de>:

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.

It means that PHP doesn't care if a string contains NULLs, so we are just discarding the ~ when it is part of the literal8 construction (since a NULL is treated as a single-byte character for PHP string processing).

RFC 6855 support is irrelevant here - literal8 is defined by BINARY so this can be tested on a server that supports BINARY. Thus, if you have a fix Jan you don't need access to a UTF-8 server to properly test.

Okay, and when is BINARY used, so I have a use case where ~ *does* indicate binary strings? Any binary attachment?

--
Jan Schneider
The Horde Project
http://www.horde.org/



___________________________________
Michael Slusarz [slus...@horde.org]

--
imp mailing list
Frequently Asked Questions: http://wiki.horde.org/FAQ
To unsubscribe, mail: imp-unsubscr...@lists.horde.org

Reply via email to