This method is not correct. It returns a const char *
, encoded as a UTF8 string. That is a perfectly sensible way of getting a C string from an NSString, but nowhere here is anyone actually doing anything with wchar_t
s.
wchar_t
is a "wide char", and a pointer to it would be a "wide string" (represented by const wchar_t *
). These are designed to precisely represent larger character sets, and can be two-byte wide character strings; they use a whole different variant set of string manipulation functions to do things with them. (Strings like this are very rarely seen in iOS development, for what it's worth.)