CocoaShare/Classes/Dropbox/DropboxSDK/MPOAuth/NSURLResponse+Encoding.m
2011-02-01 10:19:26 -06:00

28 lines
646 B
Objective-C

//
// NSURL+MPEncodingAdditions.m
// MPOAuthConnection
//
// Created by Karl Adam on 08.12.05.
// Copyright 2008 matrixPointer. All rights reserved.
//
#import "NSURLResponse+Encoding.h"
@implementation NSURLResponse (EncodingAdditions)
- (NSStringEncoding)encoding {
NSStringEncoding encoding = NSUTF8StringEncoding;
if ([self textEncodingName]) {
CFStringEncoding cfStringEncoding = CFStringConvertIANACharSetNameToEncoding((CFStringRef)[self textEncodingName]);
if (cfStringEncoding != kCFStringEncodingInvalidId) {
encoding = CFStringConvertEncodingToNSStringEncoding(cfStringEncoding);
}
}
return encoding;
}
@end