开发者

Does NSString Support Non-Standard/Non-English characters?

I am using an xml parser to populate an array. This string: 'Calle Mare de Déu de' generates an exception at [NSPlaceholderString initwithstring:]. On Snow Leopard (10.6) it reports a nil argument while on Leopard (10.5) it throws an exception bu开发者_如何学Got reports no error.

When I replace the string 'Calle Mare de Déu de' with 'Calle Mare de Deu de' then it works fine. The problem is caused by the 'é' character.

Does NSString not support this and other special characters?

Thanks Deepika


exception occur NSPlaceholderString initwithstring:] nil argument on snow leapord and on leapord exception occur but alert does not come.

You get an exception telling you you passed a nil argument because you passed a nil argument.

The string you passed there was nil. This has nothing to do with the encoding of the string, for two reasons:

  1. There is no string. (If you had passed a string, you would not have passed nil.)
  2. Strings do not have encoding; they are simply character strings. Encodings get you from human-language characters (in strings) to sequences of bytes (in data).

Moreover, if you had a string to pass to initWithString:, you would not need to create a string using initWithString:, because you already have the string. If you wanted to copy it, you could simply send it a copy message.

We don't know what you do already have, which is vitally important. Please edit your question to include the code that gets the “string” out of the database or from the XML parser and passes it to initWithString:.

Is It only due to 'é', means I want to know if NSString does not supported 'é' or any other characters

NSString supports all of the characters in Unicode. To a practical extent, this means all of them.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜