apache / cordova-plugin-file-transfer

Apache Cordova File Transfer Plugin
https://cordova.apache.org/
Apache License 2.0
596 stars 888 forks source link

fix Chinese words error in filename #177

Closed feidianbo closed 6 years ago

feidianbo commented 7 years ago

Platforms affected

iOS

What does this PR do?

What testing has been done on this change?

download a picture file and save it with Chinese word filename on iOS emulator

Checklist

cordova-qa commented 7 years ago

Cordova CI Build has completed successfully.

Commit - Link Dashboard - Link

312 tests run, 15 skipped, 0 failed.

filmaj commented 7 years ago

I think we should try to write a test for this, if possible.

purplecabbage commented 7 years ago

@feidianbo Can you provide an example url that would have failed and now will pass, short of writing the whole test.

feidianbo commented 7 years ago

@purplecabbage You can download the fowling image to check the bug: http://git.oschina.net/fdb/demo1/raw/master/风景图片.jpg The above url contains the Chinese words.

heartbeat986 commented 6 years ago

I get the same question and i had solve it. The code NSString* filePath = [source hasPrefix:@"/"] ? [source copy] : [(NSURL *)[NSURL URLWithString:source] path]; in function - (void)fileDataForUploadCommand:(CDVInvokedUrlCommand*)command , if the file path include chinese , the filePath will return nil , so the source should be encode by utf-8.

maverickmishra commented 6 years ago

With the new features introduced in XMLHttpRequest, this plugin is not needed any more. Migrating from this plugin to using the new features of XMLHttpRequest, is explained in this Cordova blog post.