URL-encoding and HTML-encoding NSStrings

后端 未结 4 1859
滥情空心
滥情空心 2021-01-04 22:14

Is their a method to encode/decode HTML and URL (in Xcode, using Objective-C)?

[NSString stringWithContentsOfFile:<#(NSString *)path#> encoding:<#(         


        
4条回答
  •  青春惊慌失措
    2021-01-04 22:56

    Returns a representation of the receiver using a given encoding to determine the percent escapes necessary to convert the receiver into a legal URL string.

    - (NSString *)stringByAddingPercentEscapesUsingEncoding:(NSStringEncoding)encoding
    

    and

    Returns a new string made by replacing in the receiver all percent escapes with the matching characters as determined by a given encoding.

    - (NSString *)stringByReplacingPercentEscapesUsingEncoding:(NSStringEncoding)encoding
    

提交回复
热议问题