Confused Confused - 1 year ago 77
iOS Question

String from filename showing %20 where spaces are in the name, unwanted

I'm bringing in images with names that contain spaces, English names and Chinese names, and using those filenames to create strings that are presented beneath their images.

This worked fine until I started putting Chinese into the image file names.

Now, unfortunately all spaces are coming in as


and an example of Chinese looks like this:


I have Chinese Simplified installed, and setup in internalisation settings of the project in Xcode... but somehow I'm missing something. Which isn't the first time, and won't be the last.

What do I need to do to make Unicode work?

Answer Source

The path is urlencoded if you urldecode the path spaces should turn out fine

For Swift 3:


For Swift 2.3:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download