• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: What encoding to use to turn NSData from a subprocess into an NSString?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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: Chris Suter <email@hidden>
  • Date: Wed, 24 May 2006 16:32:52 +1000


On 24/05/2006, at 4:15 PM, j o a r wrote:


On 24 maj 2006, at 07.56, Gerben Wierda wrote:

In that case, if I want to turn the data I get from unspecifed subprocesses into an as-readable-as-possible NSString (the data is ascii with possible 8bit characters), what is the best choice for encoding on MacOSX? MacRoman?

I have no idea what the default / most often used encoding would be. It's an interesting question. I kind of doubt that it's anything with "Mac" in the name, or anything as modern and good as UTF8.


I do not really mind that the encoding is lossy, but I do not want nil and I want as redable as possible results.

Perhaps you should prepare for nil results, and in that case attempt fallback conversions with different encodings? This should only be bad / expensive if your first choice for encoding is often incorrect, something that you should be able to easily identify and fix.


j o a r

Aren't unix tools supposed to honour the LANG environment variable? It's also worth checking that you get nil rather than an exception (in the case where you get an invalid sequence of bytes for the encoding you specify). You could always resort to using the CF versions of the functions.




_______________________________________________
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


  • Follow-Ups:
    • Re: What encoding to use to turn NSData from a subprocess into an NSString?
      • From: Jerry Krinock <email@hidden>
    • Re: What encoding to use to turn NSData from a subprocess into an NSString?
      • From: Annard Brouwer <email@hidden>
References: 
 >Re: What encoding to use to turn NSData from a subprocess into an NSString? (From: Keary Suska <email@hidden>)
 >Re: What encoding to use to turn NSData from a subprocess into an NSString? (From: Gerben Wierda <email@hidden>)
 >Re: What encoding to use to turn NSData from a subprocess into an NSString? (From: j o a r <email@hidden>)
 >Re: What encoding to use to turn NSData from a subprocess into an NSString? (From: Gerben Wierda <email@hidden>)
 >Re: What encoding to use to turn NSData from a subprocess into an NSString? (From: j o a r <email@hidden>)

  • Prev by Date: [nextCue setFloatValue:0.0]; doesn't work
  • Next by Date: Re: Bold Text
  • Previous by thread: Re: What encoding to use to turn NSData from a subprocess into an NSString?
  • Next by thread: Re: What encoding to use to turn NSData from a subprocess into an NSString?
  • Index(es):
    • Date
    • Thread