• 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
wchar_t versus unichar
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

wchar_t versus unichar


  • Subject: wchar_t versus unichar
  • From: John Stiles <email@hidden>
  • Date: Fri, 9 Jul 2004 16:46:55 -0700

It looks like Cocoa's "unichar" type is two bytes, and wchar_t is four bytes.
This is causing me grief in weird ways--for example, swprintf(buffer, L"%S", myString) needs myString to be an array of four-byte wchar_t's. But [NSString stringWithFormat:@"%S", myString] needs myString to be an array of two-byte unichars.
Is this correct? Or am I losing my marbles? This paints a weird picture for wide-character compatibility; I always assumed stringWithFormat wrapped swprintf at some level.
I know Mac OS X is happier with NS/CFStrings or UTF8, but I am dealing with a large volume of existing code that uses two-byte Unicode character arrays (dang Windows) and I don't think they'd be too thrilled if I rewrote it all.
_______________________________________________
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.


  • Prev by Date: XCode 1.2 via Software Update?
  • Next by Date: Re: XCode 1.2 via Software Update?
  • Previous by thread: Re: XCode 1.2 via Software Update?
  • Next by thread: Compositing Tricks?
  • Index(es):
    • Date
    • Thread