Permalink
Browse files

Merge pull request #39 from mrspeaker/master

Check for missing textEncodingName
  • Loading branch information...
2 parents 1cff7ee + 7ba1816 commit acf41b39bbb1f44de146a2b40a07f90c3ee3b3bf @phoboslab committed Oct 20, 2012
Showing with 5 additions and 3 deletions.
  1. +5 −3 Classes/Ejecta/EJUtils/EJBindingHttpRequest.m
@@ -35,9 +35,11 @@ - (NSString *)getResponseText {
if( !response || !responseBody ) { return NULL; }
NSStringEncoding encoding = NSASCIIStringEncoding;
- CFStringEncoding cfEncoding = CFStringConvertIANACharSetNameToEncoding((CFStringRef) [response textEncodingName]);
- if( cfEncoding != kCFStringEncodingInvalidId ) {
- encoding = CFStringConvertEncodingToNSStringEncoding(cfEncoding);
+ if ( response.textEncodingName ) {
+ CFStringEncoding cfEncoding = CFStringConvertIANACharSetNameToEncoding((CFStringRef) [response textEncodingName]);
+ if( cfEncoding != kCFStringEncodingInvalidId ) {
+ encoding = CFStringConvertEncodingToNSStringEncoding(cfEncoding);
+ }
}
return [[[NSString alloc] initWithData:responseBody encoding:encoding] autorelease];

0 comments on commit acf41b3

Please sign in to comment.