Re: Unicode in XCode?
Re: Unicode in XCode?
- Subject: Re: Unicode in XCode?
- From: Christopher Hunt <email@hidden>
- Date: Fri, 1 Oct 2004 10:41:31 +1000
On 01/10/2004, at 1:40 AM, email@hidden wrote:
Unfortunately, I can make use of CFString only to feed the Carbon APIs,
because it does not exist on Windows platform. I've written my own
portable String class which wraps a Unicode character buffer, using
string functions from standard C library.
I've avoided using the standard C library to wrap Unicode character
buffers. The reason for this is that <string> doesn't *understand*
Unicode - for example it cannot correctly compare two Unicode strings.
IMHO you're much better off having a vector<short> for UTF-16 than
having a wstring and then calling OS specific functions to manipulate
the strings. You then factor out the OS specific Unicode processing
from your common build files and develop it for each specific platform.
I've gone one step further with my code though. Instead of having a
vector<short> as a container for UTF-16 strings, I've written a wrapper
class that refers to an OS specific instance of a Unicode string. I did
this because moving things in and out of a vector<short> is relatively
expensive to dealing with an OS ref counted string. When it comes to
some OS specific portion of code having to do something with the
string, it derefs the wrapper instance, assumes it is a CFString (for
OS X) and does what it needs to do.
'hope that this is useful.
Kind regards,
Christopher
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden