Skip to content
This repository has been archived by the owner on Aug 29, 2020. It is now read-only.

Commit

Permalink
Bug fixes (URL parsing): Various bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Nick Toumpelis committed Mar 2, 2009
1 parent 87220a4 commit 6299945
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions trunk/NSMutableAttributedString+ORSCanaryAdditions.m
Expand Up @@ -18,7 +18,7 @@ - (NSCharacterSet *) httpDelimitingCharset {
[charset addCharactersInString:@"±§$%^*(){}[];'\"\\|,<>`ÅÍÎÏ¡™£¢∞§¶"];
[charset addCharactersInString:@"•ªº≠œ∑´®†¥¨ˆøπ“‘åß∂ƒ©˙∆˚¬…æ«ÓÔ˘¿Â¯"];
[charset addCharactersInString:@"Ω≈ç√∫˜µ≤≥÷€‹›fifl‡°·—Œ„´‰ˇÁ¨ˆØ∏”’˝ÒÚÆ"];
[charset addCharactersInString:@"»¸˛Ç◊ı˜"];
[charset addCharactersInString:@"»¸˛Ç◊ı˜!"];
return charset;
}

Expand Down Expand Up @@ -56,6 +56,11 @@ - (NSCharacterSet *) hashtagDelimitingCharset {
- (NSString *) detectURL:(NSString *)string {
NSRange range;

range = [string rangeOfString:@"www.."];
if (range.location != NSNotFound) {
return nil;
}

range = [string rangeOfString:@"http://"];
if (range.location != NSNotFound) {
NSString *substring = [string substringFromIndex:range.location];
Expand All @@ -69,7 +74,7 @@ - (NSString *) detectURL:(NSString *)string {
}

range = [string rangeOfString:@"www."];
if (range.location != NSNotFound) {
if (range.location == 0) {
NSString *substring = [string substringFromIndex:range.location];
NSRange charsetRange = [substring
rangeOfCharacterFromSet:[self httpDelimitingCharset]];
Expand Down

0 comments on commit 6299945

Please sign in to comment.