Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

ContentType not correctly parsed #25

Open
JanC opened this Issue Aug 3, 2012 · 2 comments

Comments

Projects
None yet
2 participants

JanC commented Aug 3, 2012

Hi,
it looks like the Content-Type header line is parsed only by the "main" type (e.g. "text") and "subtype" (e.g. "plain") but not the rest.

CTCoreMessage *msg = [[CTCoreMessage alloc] initWithString:@"Subject: MySubject\n"
            "Content-Type: text/plain; charset=us-ascii"];
msg.fetchBodyStructure;

NSLog(@"ContentType: %@", [(CTMIME_TextPart*)msg.mime.content contentType]);

The resulting Content-Type is "text/plain" and the charset is dropped.

JanC commented Aug 3, 2012

The entire header itself is not parsed. If I supply a text/html type, it is parsed as text/plain:

CTCoreMessage *msg = [[CTCoreMessage alloc] initWithString:@"Subject: MySubject\n"
            "Content-Type: text/html; charset=us-ascii"];
msg.fetchBodyStructure;
NSLog(@"ContentType: %@", [(CTMIME_TextPart*)msg.mime.content contentType]);

output is

ContentType: text/plain

omolowa commented Dec 18, 2012

As far as I can see in the code, the CTMIME_TextPart class is statically creating a text/plain instance. Could you try it with a

NSLog(@"ContentType: %@", [(CTMIME*)msg.mime.content contentType]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment