Well, certainly one way would be to preprocess the text buffer, converting the custom characters into a standard encoding like UTF-8, then passing the processed buffer into +[NSString stringWithUTF8String:]. At that point it would "just work" since it's in a known encoding.

Depending on what your legacy encoding looks like, the conversion may be as simple as creating a 256-byte table if it turns out that the legacy characters map to single-byte UTF-8 sequences or a 256xn table if there are multi-byte sequences, and then using it to map legacy- >UTF-8.

steve


On Aug 16, 2009, at 12:46 PM, tim lindner wrote:

Is it possible to add an encoding to CoCoa?

I have some text data from a legacy system which is ASCII for 0-127, but
128-255 is unique to the system. I'd like to load it into a text view
and "just have it work".

What options do I have?

_______________________________________________

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 arch...@mail-archive.com

Reply via email to