| | 39 | if(documentString == nil) |
| | 40 | { |
| | 41 | //Most likely this is UTF-8 and some moron doesn't understand that the meta tags need to follow the same encoding. |
| | 42 | NSMutableData *mutData = [documentData mutableCopy]; |
| | 43 | int length = [mutData length]; |
| | 44 | const char *bytes = [mutData bytes]; |
| | 45 | const char *location; |
| | 46 | while((location = strnstr(bytes, "<meta", length)) != NULL) |
| | 47 | { |
| | 48 | int offset = location - bytes; |
| | 49 | const char *end = strnstr(location, ">", length-offset); |
| | 50 | if(end != NULL) |
| | 51 | { |
| | 52 | int replaceLength = end-location+2; |
| | 53 | [mutData replaceBytesInRange:NSMakeRange(offset, replaceLength) withBytes:"" length:0]; |
| | 54 | bytes = [mutData bytes]; |
| | 55 | length = [mutData length]; |
| | 56 | } |
| | 57 | else |
| | 58 | break; |
| | 59 | } |
| | 60 | documentString = [[NSString alloc] initWithData:mutData encoding:responseEncoding]; |
| | 61 | [mutData release]; |
| | 62 | } |