When parsing documents with non-standard charset, set the charset actually

used in the content type so that we can unparse the data properly too.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@19831 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-Macdonald 2004-08-06 13:26:25 +00:00
parent b31c59f874
commit 303acd3d68
2 changed files with 28 additions and 0 deletions

View file

@ -1,3 +1,10 @@
2004-05-30 Richard Frith-Macdonald <rfm@gnu.org>
* Source/GSMime.m: When using non-ascii default characterset
ensure that the content type header has the appropriate
charset parameter added during parsing, so unparsing will
work correctly.
2004-08-05 01:59 Alexander Malmberg <alexander@malmberg.org>
* Source/NSDistantObject.m (DO_FORWARD_INVOCATION): Warning if we

View file

@ -2242,6 +2242,27 @@ NSDebugMLLog(@"GSMime", @"Header parsed - %@", info);
if (typeInfo == nil)
{
stringEncoding = _defaultEncoding;
if (stringEncoding != NSASCIIStringEncoding)
{
NSString *charset;
if (typeInfo == nil)
{
typeInfo = [GSMimeHeader new];
[typeInfo setName: @"content-type"];
[typeInfo setValue: @"text/plain"];
[typeInfo setObject: @"text"
forKey: @"Type"];
[typeInfo setObject: @"plain"
forKey: @"Subtype"];
[document setHeader: typeInfo];
RELEASE(typeInfo);
}
charset = [GSMimeDocument charsetFromEncoding:
stringEncoding];
[typeInfo setParameter: charset
forKey: @"charset"];
}
}
else
{