JohnGaby
asked on
How do I declare a literal unicode string for the Mac
How do I declare a literal unicode string? For example, with Windows I would simply use:
WCHAR text[] = L"This is a unicode string";
For the Mac, I would like to do something like
UniChar text[] = L"This is a unicode string";
Now I know about CFSTR and CFStringRef, and that is not what I am looking for. Is there a way to declare non-encapsulated literal unicode strings?
WCHAR text[] = L"This is a unicode string";
For the Mac, I would like to do something like
UniChar text[] = L"This is a unicode string";
Now I know about CFSTR and CFStringRef, and that is not what I am looking for. Is there a way to declare non-encapsulated literal unicode strings?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
>> I am quite aware of the different flavors of unicode
Good, just wanted to be sure we're all on the same page -- it seems we are :)
>> OS X is Unix, so of course the type wchar_t is 32 bit, and therefore does not seem to be very useful in this context.
We handle all strings internally as UTF8 as it's the simplest way to provide cross-platform portability. We convert, if necessary, at the interface boundary.
Sorry, I don't know Macs so I can't advise specifically.
Good, just wanted to be sure we're all on the same page -- it seems we are :)
>> OS X is Unix, so of course the type wchar_t is 32 bit, and therefore does not seem to be very useful in this context.
We handle all strings internally as UTF8 as it's the simplest way to provide cross-platform portability. We convert, if necessary, at the interface boundary.
Sorry, I don't know Macs so I can't advise specifically.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I am a Windows programmer, so I am used to having my whole program use UTF16 strings everywhere. I am also used to being able to index these strings, which I cannot do with CFString(?). What I was wondering if there was a way to declare literal UTF16 (UniChar) strings for the Mac, or am I forced to use CFString everywhere?
OS X is Unix, so of course the type wchar_t is 32 bit, and therefore does not seem to be very useful in this context.