【问题标题】:NSString that contain lots of null termination? [duplicate]包含大量空终止的 NSString? [复制]
【发布时间】:2023-03-04 15:32:01
【问题描述】:

可能重复:
In ios 3des encryption contain lots of null termination.when i convert NSData to NSString , it will endup to first null termination?

当我将加密的 NSData 转换为 NSString 时,因为数据包含大量空终止,NSString 在第一个空终止时结束,变量无法包含整个数据。但我必须在服务器上发送加密字符串。我该怎么做才能将 NSData 转换为 NSString。包含所有数据的字符串意味着(如果数据包含空终止。在这种情况下字符串不会结束)?

【问题讨论】:

  • 显示代码你到目前为止得到了什么。
  • 服务器使用什么类型的加密?给我看看样品?
  • 如果需要,请编辑您的旧问题,不要问几乎相同的新问题。

标签: iphone encryption nsstring nsdata


【解决方案1】:

尝试更改转换格式,如下所示

NSString* myString;
myString = [[NSString alloc] initWithData:nsdata encoding:NSASCIIStringEncoding];

【讨论】:

  • 先生,我尝试过这种转换格式。但它会在第一个 \0
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-11-24
相关资源
最近更新 更多