• 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: How to code a NSString literal with UTF8?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to code a NSString literal with UTF8?


  • Subject: Re: How to code a NSString literal with UTF8?
  • From: Will Mason <email@hidden>
  • Date: Tue, 29 Mar 2005 21:58:55 -0800 (PST)
  • Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys

> The Xcode editor lets you define a file encoding as UTF8. You can
> then type in a line like:
>
> NSString *foo = @"blah blah";
>
> where blah blah have Unicode characters in them with encoded as UTF8.
>
> But, when I ask this string for its characters I get garbage back,
> and length is not correct.
>
> What would the best way to do this be?

This has been discussed many times on the list and even recently. You
could check the archives. The bottom line is that the literal strings
which are defined with "@" cannot be relied upon for any non-ASCII
encoding. It has nothing to do with the encoding of the file; it is
dependent upon the encodings that NSConstantString supports, which
number very few (I think only one, in fact). You'll either have to use
localized strings or a specific encoding for the string in which you
are interested. You may want to look at:

http://developer.apple.com/documentation/MacOSX/Conceptual/BPInternational/Tasks/GettingStrings.html

I hope this helps,
Will
 _______________________________________________
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

  • Prev by Date: Re: NSImage Rotation
  • Next by Date: Re: Creating controls dynamically
  • Previous by thread: Re: How to code a NSString literal with UTF8?
  • Next by thread: LSBackgroundOnly Cached?
  • Index(es):
    • Date
    • Thread