Re: What encoding to use to turn NSData from a subprocess into an NSString?
Re: What encoding to use to turn NSData from a subprocess into an NSString?
- Subject: Re: What encoding to use to turn NSData from a subprocess into an NSString?
- From: Keary Suska <email@hidden>
- Date: Tue, 23 May 2006 17:52:36 -0600
on 5/23/06 5:14 PM, email@hidden purportedly said:
> If I have a NSFileHandle that reads from a unix subprocess the stderr
> output (this is supposed to be readable output, say the output of a
> gnutar command) what encoding do I use to turn the NSData I get with
> availableData into an NSString (using initWIthData:encoding)?
>
> The data is ascii, generally, but I cannot be sure there is no 8-bit
> value in there. What happens if NSASCIIStringEncoding encounters an 8-
> bit value (say an accented character)?
>
> I have been using NSUTF8StringEncoding so far because I read the docs
> as that this was an 8 bit encoding. But I have been told that this is
> wrong.
The short answer is that you need to use the encoding that the source data
is encoded in. So once you know what encoding that is, that would be the
encoding you use.
Best,
Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden