URLEncode With Objective C - The OAUTH Way

Coming from a PHP background, we should all be thankful to rawurlencode() from PHP! Here’s an Objective C version with OAUTH v1.0a requirements.

- (NSString *)urlencode:(NSString *)text {
    NSString *temp = @"";

    for(int i=0, max=[text length]; i=0x30 && b<=0x39) ||
           (b>=0x41 && b<=0x5A) ||
           (b>=0x61 && b<=0x7A)
            ) {
            temp = [temp stringByAppendingFormat:@"%c", t];
        } else {
            temp = [temp stringByAppendingString:@"%"];
            if (b <= 0xf) temp = [temp stringByAppendingString:@"0"];
            temp = [NSString stringWithFormat:@"%@%X", temp, b];
        }
    }
    
    return temp;
}

Spontaneous Writing Episode II

The second episode of Spontaneous Writing is now in session continuing from this previous session. For tonight, my iTunes is happily playing songs by Tohpati in his rather old solo album. By the way, from what I’ve been trying to do the past few weeks, it seems that only when I got home will then writing moments will be abundant for my fingers. Can’t seem to do this while at the office. [Read More]