NSBundle's path resolution is broken with unicode

Number:rdar://26897226 Date Originated:
Status:Open Resolved:
Product: Product Version:
Classification: Reproducible:
Peter Steinberger20-Jun-2016 08:33 PM

Something not on this list

Area: Foundation. (Why is that not on the list?)

 [[NSBundle bundleForClass:self.class] pathForResource:fileName ofType:@"txt" inDirectory:folderName]; clips too much when the directory contains unicode characters.

Steps to Reproduce:
Open Radar. Observe that there are no lyrics loaded for Call Me Maybe.
Replace textFilePathNotWorkingRadar with textFilePath to get lyrics :)

Radar sample code is on https://github.com/PSPDFKit-labs/radar.apple.com. I uploaded it here as well, but please use the GitHub one as we often tweak and update sample projects.

Expected Results:
Unicode should just work. I know, it's not that easy ;)

Actual Results:
One character at the end is removed, breaking the path.

iOS 9.3.2

Same issue in Xcode 8b1/iOS 10.0b1

Xcode 7.3.1

'NSBundleFolderLoadingIssue.zip' was successfully uploaded.


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!