Re: NSString vs. encoding

2009-09-18 Thread Johan Kool
Op 17 sep 2009, om 22:29 heeft Andrew Farmer het volgende geschreven: On 16 Sep 2009, at 22:55, Johan Kool wrote: Thanks so much!! That is indeed the case! I now use strunvis and it's all done in just 4 lines of code. (Well, except that I should still handle a returned error code.) int

Re: NSString vs. encoding

2009-09-17 Thread Andrew Farmer
On 16 Sep 2009, at 22:55, Johan Kool wrote: Thanks so much!! That is indeed the case! I now use strunvis and it's all done in just 4 lines of code. (Well, except that I should still handle a returned error code.) int len = [stringA lengthOfBytesUsingEncoding:NSUTF8StringEncoding]; c

Re: NSString vs. encoding

2009-09-16 Thread Johan Kool
Op 16 sep 2009, om 22:14 heeft Joar Wingfors het volgende geschreven: On 16 sep 2009, at 21.38, Johan Kool wrote: I am parsing the output of a command line utility (mtree). Is mtree using strvis perhaps? Google seems to suggest that, but I'm not sure if that's true, or still true. If you

Re: NSString vs. encoding

2009-09-16 Thread Joar Wingfors
On 16 sep 2009, at 21.38, Johan Kool wrote: I am parsing the output of a command line utility (mtree). Is mtree using strvis perhaps? Google seems to suggest that, but I'm not sure if that's true, or still true. If you're using an open source utility, it should be possible for you to fig

Re: NSString vs. encoding

2009-09-16 Thread Johan Kool
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

Re: NSString vs. encoding

2009-09-16 Thread Joar Wingfors
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 ne

Re: NSString vs. encoding

2009-09-16 Thread Greg Guerin
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. Obvious answer: write your own parser.

Re: NSString vs. encoding

2009-09-16 Thread Stephen J. Butler
On Wed, Sep 16, 2009 at 3:13 PM, 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. Basical

Re: NSString vs. encoding

2009-09-16 Thread Johan Kool
Op 16 sep 2009, om 12:44 heeft Greg Guerin het volgende geschreven: Johan Kool wrote: NSString *stringA = @"J\\303\\270ha\\314\\212n\\040i\\314\\210s\ \040Li\ \314\\200e\\314\\201\\306\\222"; NSLog(@"stringA %@ (expected Jøhån ïs Lìéƒ)", stringA); You're doing it wrong. I know. :-) Henc

Re: NSString vs. encoding

2009-09-16 Thread Greg Guerin
Johan Kool wrote: NSString *stringA = @"J\\303\\270ha\\314\\212n\\040i\\314\\210s\ \040Li\ \314\\200e\\314\\201\\306\\222"; NSLog(@"stringA %@ (expected Jøhån ïs Lìéƒ)", stringA); You're doing it wrong. NSNonLossyASCIIStringEncoding expects one escaped unit per Unicode code-point. It doe

Re: NSString vs. encoding

2009-09-16 Thread Johan Kool
Op 15 sep 2009, om 23:15 heeft Johan Kool het volgende geschreven: Op 15 sep 2009, om 22:26 heeft Stephen J. Butler het volgende geschreven: On Wed, Sep 16, 2009 at 12:10 AM, Johan Kool wrote: Op 15 sep 2009, om 21:50 heeft Jens Alfke het volgende geschreven: On Sep 15, 2009, at 9:04 PM, Jo