hachinoBlog

hachinobuのエンジニアライフ

URLエンコード

APIにデータを投げるときはURLエンコードするのは基本!

NSString *str = (NSString *)CFURLCreateStringByAddingPercentEscapes(
        NULL,
        (CFStringRef)エンコード対象を含む文字,
        NULL,
        (CFStringRef)@"!*'();:@&=+$,/?%#[]",
        kCFStringEncodingUTF8 );

参考URL
http://blog.daisukeyamashita.com/post/1686.html
http://blog.justoneplanet.info/2011/09/24/objective-c%E3%81%A7url%E3%82%A8%E3%83%B3%E3%82%B3%E3%83%BC%E3%83%89%E3%81%99%E3%82%8B/