NSString contents get truncated because of the null character in the middle of the string

前端 未结 1 1524
不知归路
不知归路 2021-01-23 11:28

I am getting null character in the middle of the string obtained as a part of response to HTTP Post. As a result the content gets printed only upto the null character even thoug

相关标签:
1条回答
  • 2021-01-23 12:08

    The problem characters are UTF-8 encoded something (EF BF BD and C2 BF) that are handled badly directly in quoted strings in XCode. You will need to convert it. Something like:

    [ NSString stringWithUTF8String: [ @"v1db1���������¿¿sssss" cStringUsingEncoding: [ NSString defaultCStringEncoding ] ] ];
    
    0 讨论(0)
提交回复
热议问题