// NSString to NSData
NSString *str = @"http://cnblogs.com/zhudongfang";
NSData *data = [str dataUsingEncoding:NSUTF8StringEncoding];
// NSData to NSString
NSString *newStr = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
// 编码统一用utf8,这样才不会乱码