Re: NSString vs. encoding
Re: NSString vs. encoding
- Subject: Re: NSString vs. encoding
- From: Johan Kool <email@hidden>
- Date: Wed, 16 Sep 2009 21:38:52 -0700
Op 16 sep 2009, om 19:32 heeft Joar Wingfors het volgende geschreven:
On 16 sep 2009, at 13.13, Johan Kool wrote:
I have been trying many combinations of encodings/decodings, but
without the intended result. I do know what NSString wants, but
that's not what I have. I have stringA as shown, and I have to
somehow morph it into something usable. Basically I need NSString
to interpret the characters a second time, but NSString seems to do
all it can to keep it as is. Normally, that's indeed what I want,
but not now...
I'm surprised that the most important question has not been asked
yet: Where are you getting this string from, and how are you getting
it into your application?
I am parsing the output of a command line utility (mtree). This
outputs a text file, with the parts of the texts encoded as I've
mentioned. It does put it there encoded like this on purpose, as to
stand out from the rest of the tab and space delimited text. I wish
they would have chosen a more sensible format like XML, but I don't
think that was around yet when this utility was written.
So only parts of the incoming text have this encoding, and it is only
on those bits that I am trying to do this decoding.
As suggested earlier, I am now parsing it myself, which does seem to
work great, except that I overlooked that -[NSData
rangeOfData:options:range:] is new to 10.6. I need to support 10.5
too, so I need to redo that bit differently.
Johan
---
http://www.johankool.nl/
KOOLISTOV - Software for Mac and iPhone
http://www.koolistov.net/
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden