mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
Tidy hanbdleing of encoding type
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@13922 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
9f124f25ee
commit
1d502f118c
1 changed files with 24 additions and 19 deletions
|
@ -3586,11 +3586,12 @@ static NSCharacterSet *tokenSet = nil;
|
|||
}
|
||||
type = [self headerNamed: @"content-type"];
|
||||
}
|
||||
enc = [self headerNamed: @"content-transfer-encoding"];
|
||||
|
||||
if ([[type objectForKey: @"Type"] isEqual: @"multipart"] == YES)
|
||||
{
|
||||
NSString *v;
|
||||
|
||||
enc = [self headerNamed: @"content-transfer-encoding"];
|
||||
if (enc != nil)
|
||||
{
|
||||
[NSException raise: NSInternalInconsistencyException
|
||||
|
@ -3605,35 +3606,39 @@ static NSCharacterSet *tokenSet = nil;
|
|||
}
|
||||
boundary = [v dataUsingEncoding: NSASCIIStringEncoding];
|
||||
}
|
||||
else if (enc == nil)
|
||||
else
|
||||
{
|
||||
d = [self convertToData];
|
||||
enc = [GSMimeHeader alloc];
|
||||
if ([[type objectForKey: @"Type"] isEqual: @"text"] == YES)
|
||||
enc = [self headerNamed: @"content-transfer-encoding"];
|
||||
if (enc == nil)
|
||||
{
|
||||
NSString *charset = [type parameterForKey: @"charset"];
|
||||
|
||||
if ([charset isEqual: @"ascii"] || [charset isEqual: @"us-ascii"])
|
||||
enc = [GSMimeHeader alloc];
|
||||
if ([[type objectForKey: @"Type"] isEqual: @"text"] == YES)
|
||||
{
|
||||
enc = [enc initWithName: @"content-transfer-encoding"
|
||||
value: @"7bit"
|
||||
parameters: nil];
|
||||
NSString *charset = [type parameterForKey: @"charset"];
|
||||
|
||||
if ([charset isEqual: @"ascii"] || [charset isEqual: @"us-ascii"])
|
||||
{
|
||||
enc = [enc initWithName: @"content-transfer-encoding"
|
||||
value: @"7bit"
|
||||
parameters: nil];
|
||||
}
|
||||
else
|
||||
{
|
||||
enc = [enc initWithName: @"content-transfer-encoding"
|
||||
value: @"8bit"
|
||||
parameters: nil];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
enc = [enc initWithName: @"content-transfer-encoding"
|
||||
value: @"8bit"
|
||||
value: @"base64"
|
||||
parameters: nil];
|
||||
}
|
||||
[self addHeader: enc];
|
||||
RELEASE(enc);
|
||||
}
|
||||
else
|
||||
{
|
||||
enc = [enc initWithName: @"content-transfer-encoding"
|
||||
value: @"base64"
|
||||
parameters: nil];
|
||||
}
|
||||
[self addHeader: enc];
|
||||
RELEASE(enc);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in a new issue