iOS url编码 7%89%B9%E6%AE%8A%E

通过POST方法,程序内获得的数据为:

%E7%89%B9%E6%AE%8A%E5%AD%97%E7%AC%A6%E6%B5%8B%E8%AF%95%EF%BC%9A%E4%B8%8B%E9%9D%A2%E6%9C%89%E4%B8%AA%E7%A9%BA%E6%A0%BC+%E6%8E%A5%E4%B8%8B%E6%9D%A5%E6%98%AF%E5%8A%A0%E5%8F%B7%2B%E5%87%8F%E5%8F%B7-%E7%AD%89%E4%BA%8E%E5%8F%B7%3D

将获得的数据使用如下方法处理:

-(Nsstring *)decodeFromPercentEscapeString:(Nssting *)input {
    NSMutableString *outputStr = [NSMutableString stringWithString:input];
    [outputStr replaceOccurrencesOfString:@"+" withString:@" " options:NSLiteralSearch range:NSMakeRange(0, [outputStr length]);

    return [outputStr stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
}
本文来自:http://www.tuicool.com/articles/NBj2uu

你可能感兴趣的:(iOS url编码 7%89%B9%E6%AE%8A%E)