Ticket #153 (closed defect: fixed)

Opened 5 weeks ago

Last modified 4 weeks ago

encodeAsURIComponent doesn't work correctly

Reported by: kaz Owned by: kaz
Priority: normal Milestone: TwitterFon 1.0.1
Component: TwitterFon Version: TwitterFon 1.0
Severity: major Keywords:
Cc:

Description

Current implementation of encodeAsURIComponent is not works correctly. It works like encodeAsURI. Need to implement like following:

- (NSString*)encodeAsURIComponent
{
	const char* p = [self UTF8String];
	NSMutableString* result = [NSMutableString string];
	
	for (;*p ;p++) {
		unsigned char c = *p;
		if ('0' <= c && c <= '9' || 'a' <= c && c <= 'z' || 'A' <= c && c <= 'Z' || c == '-' || c == '_') {
			[result appendString:[NSString stringWithCString:(char*)&c length:1]];
		} else {
			[result appendString:[NSString stringWithFormat:@"%%%02X", c]];
		}
	}
	return result;
}

Change History

Changed 4 weeks ago by kaz

  • status changed from new to closed
  • resolution set to fixed

(In [839]) *Fixed #153

  • Re-implement encodeAsURICompoent
Note: See TracTickets for help on using tickets.