What is the correct encoding for filesystem path strings?

When I take the path in NSString

and wrap and use it in the C API like:

CGDataProviderRef CGDataProviderCreateWithFilename(const char *filename );

      

What is the correct path encoding when aligning to char*

? UTF8? (ASCII- ??)

It seems to me like it should be obvious or obviously documented, but I'm having trouble thinking and / or answering.

+3


source to share


2 answers


+4


source


example that worked for me using the above answer



NSString *path =@"/Users/ethansanford/Desktop/mutable string logic/mutable string logic/long-arrow-right.png" ;
CGDataProviderRef provider = CGDataProviderCreateWithFilename(path.fileSystemRepresentation);
imageRef2 =CGImageCreateWithPNGDataProvider(provider, NULL, false, kCGRenderingIntentDefault);

      

0


source







All Articles