Ticket #153 (closed defect: fixed)
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
Note: See
TracTickets for help on using
tickets.
