简体   繁体   中英

How to resolve ftp url with special characters like @,$?

有人可以建议如何使用特殊字符解析ftp网址。

Take the string, use the stringByAddingPercentEscapesUsingEncoding method to escape it, then you can use it normally:

NSString *fuzzyUrl = @"ftp://jailbreak.apple.com/?foo=@@@&bar=$$$&baz=¥¥¥";
NSString *urlString = [fuzzyUrl stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSURL *url = [[NSURL alloc] initWithString:urlString];
// ...
// your code here
// ...
[url release];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM