UTF-8 should only be used for text files that are expected to be passed to legacy software (including Internet applications). For text that is not in a plain text file (or HTML or other MIME subtype of TEXT), UTF-16 is preferred.

NSString will interpret the BOM for you if you indicate the encoding is "external".

Deborah Goldsmith
Apple Inc.
[EMAIL PROTECTED]

On Mar 19, 2008, at 11:34 AM, Jens Alfke wrote:

On 19 Mar '08, at 10:04 AM, J. Todd Slack wrote:

How do I write an ASCII 254 and ASCII 255 at the beginning of the NSString that I am putting in the file I want to be read back in at a later date? '

Those wouldn't go into the NSString; they're the byte-order-mark that prefixes the UTF-16 data, not part of the character data itself.

I really recommend you write out the string in UTF-8 instead, as I suggested yesterday (with example code). UTF-8 is the most common modern encoding for text, because (a) it's a superset of ascii, and (b) for Roman alphabets it's up to twice as compact as UTF-16.

—Jens_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/goldsmit%40apple.com

This email sent to [EMAIL PROTECTED]

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to