• 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: Converting C strings into NSStrings (and vice versa)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Converting C strings into NSStrings (and vice versa)


  • Subject: Re: Converting C strings into NSStrings (and vice versa)
  • From: Ondra Cada <email@hidden>
  • Date: Thu, 27 Apr 2006 16:56:52 +0200

Paolo,

On 27.4.2006, at 16:38, Paolo Bertani wrote:

NSString *s = [NSString stringWithCString:cstring encoding:kTextEncodingWindowsANSI];

where on earth you got the k-thing from? All the Cocoa constants are capitalized and have an NS- prefix (so that they don't clash with other constants).


Namely, the encoding ones have -StringEncoding suffix. What you probably want here would be NSWindowsCP1251StringEncoding (enter "nswindows" in the docs search field in Xcode to see all of them).

Incidentally, note also that there is a number of supported encodings which have no defined symbolic constant. To see them all, try

const NSStringEncoding *ec=[NSString availableStringEncodings];
for (;*ec;ec++) NSLog(@"%@: %d",[NSString localizedNameOfStringEncoding:*ec],*ec);


---
Ondra Čada
OCSoftware:     email@hidden               http://www.ocs.cz
private         email@hidden             http://www.ocs.cz/oc


Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
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: Converting C strings into NSStrings (and vice versa)
      • From: Paolo Bertani <email@hidden>
References: 
 >Converting C strings into NSStrings (and vice versa) (From: Paolo Bertani <email@hidden>)

  • Prev by Date: Re: Converting C strings into NSStrings (and vice versa)
  • Next by Date: Re: Converting C strings into NSStrings (and vice versa)
  • Previous by thread: Re: Converting C strings into NSStrings (and vice versa)
  • Next by thread: Re: Converting C strings into NSStrings (and vice versa)
  • Index(es):
    • Date
    • Thread