• 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: 8-bit chars in @""
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 8-bit chars in @""


  • Subject: Re: 8-bit chars in @""
  • From: Ali Ozer <email@hidden>
  • Date: Mon, 25 Mar 2002 11:42:32 -0800

> [NSString stringWithCharacters:(unichar*)"\x20\x22" length:1]
>
> That's my favorite as being easiest to read when you know the hex
> unicode
> values, and as being self-contained. The cast is just to stave off the
> compiler warning; it isn't really necessary.

Ah, but this is not endian-safe! (This might be academic, but it's
always a good idea to write endian-independent code.) If you're going
to be taking this approach, the UTF-8 version is safer:

> [NSString stringWithUTF8String: "\xE2\x80\xA2"]

Ali
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: 8-bit chars in @"" (From: Matt Neuburg <email@hidden>)

  • Prev by Date: Re: 8-bit chars in @""
  • Next by Date: Re: 8-bit chars in @""
  • Previous by thread: Re: 8-bit chars in @""
  • Next by thread: Re: 8-bit chars in @""
  • Index(es):
    • Date
    • Thread