• 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: (newbie question) Putting special characters in NSStrings
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: (newbie question) Putting special characters in NSStrings


  • Subject: Re: (newbie question) Putting special characters in NSStrings
  • From: Nicko van Someren <email@hidden>
  • Date: Fri, 18 Mar 2005 21:39:57 +0000

On 18 Mar 2005, at 20:40, Matt Neuburg wrote:

On Fri, 18 Mar 2005 11:33:36 -0800, Ben Borofka <email@hidden> said:
I have a bunch of special characters I need to put in NSStrings and
NSArrays of NSStrings:
" ! @ # $ % ^ *
I've been just using, for example, [[NSString alloc ]
initWithString:@"!"] to create the string but I don't think they are
working for all those special characters. What's the best way to put
those into an NSString? I can't find any simple, easy examples.
...
    NSArray* a = [NSArray arrayWithObjects:
        @"\"",  @"!", @"#", @"$", @"%", @"^", @"*", nil];
...
It works fine. m.

On the other hand [NSArray arrayWithObjects: @"£", @"±", @"§", @"€", nil] has some decidedly odd behaviour because X-code UTF-8 encodes the top-bit set characters (in fact the Euro symbol is not even an 8 bit character). In order to handle these you can use [NSString stringWithUTF8String: "±§£€"], which will work as expected as long as you select Format->File Encoding->Unicode (UTF-8), which is certainly the default in the UK and may well be elsewhere.


	Cheers,
		Nicko

_______________________________________________
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: (newbie question) Putting special characters in NSStrings
      • From: "Sean McBride" <email@hidden>
References: 
 >Re: (newbie question) Putting special characters in NSStrings (From: Matt Neuburg <email@hidden>)

  • Prev by Date: Re: (newbie question) Putting special characters in NSStrings
  • Next by Date: NSTimer causes events to be lost
  • Previous by thread: Re: (newbie question) Putting special characters in NSStrings
  • Next by thread: Re: (newbie question) Putting special characters in NSStrings
  • Index(es):
    • Date
    • Thread