stringByAddingPercentEscapesUsingEncoding not working with NSStrings with ' 0'

前端 未结 2 2082
广开言路
广开言路 2020-12-17 05:21

I have been having some problem with the stringByAddingPercentEscapesUsingEncoding: method. Here\'s what happens:

When I try to use the method to conver

2条回答
  •  情话喂你
    2020-12-17 05:29

    This happens when you're trying to encode to NSASCIIStringEncoding a string with characters not supported by ASCII.

    Make sure you're encoding to NSUTF8StringEncoding, if the string can contain UTF8 characters or the method would return nil.

提交回复
热议问题