[swift-evolution] [Pitch] Remove transparent bridging between Swift strings and char *
kenny_leung at pobox.com
Wed Jun 22 15:01:46 CDT 2016
> On Jun 22, 2016, at 12:37 PM, Ben Rimmington <me at benrimmington.com> wrote:
> But the cString(using:) method is from Foundation, and using UTF-8 should always succeed in any case.
I suppose you’re right about that, but now it brings up more confusion in my mind about what’s in Foundation and what’s in the standard library. So would there be extensions on String in (Swift) Foundation that implements cString(encoding:)? What decides what functions are in the standard library and what are in Foundation?
> UTF-8 by default is probably correct for POSIX APIs, but maybe not for Windows APIs (if code pages are expected).
I guess it all depends on what you think should be valid for C strings. Based on the documentation, I guess the core team thinks UTF-8 is valid.
More information about the swift-evolution