Order of the Butterfly
Posts: 373 from 2014/6/11
IMO 'cString' is too generic. What is a c-string anyway? The encoding always matters.
That's why Apple deprecated -cString in favor of cStringUsingEncoding:.
Now that's just saying OBFramework needs to copy all the legacy in Foundation.
No, I didn't say that. And "-cString" is actually legacy.Quote:
They had a cString method without properly defining the encoding, so they needed UTF8String. OBFramework has no legacy - cString always returns an UTF8 encoded string, period. I'll probably add UTF8String method to make porting easier though.
When -cString was deprecated (in 10.4) they've introduced -cStringUsingEncoding: and -getCString:length:encoding:.
Because the encoding matters. You can't always assume the use-case you're implementing requires UTF8.
And, the name "-cString" is harder to reason. You have to look up some documentation to actually look what exactly it does.