diff --git a/README.md b/README.md index 1a467d08..a70a4adc 100644 --- a/README.md +++ b/README.md @@ -88,7 +88,8 @@ const options = { // Below are options only supported on Android notification: { enabled: true - } + }, + useUtf8Charset: true } Upload.startUpload(options).then((uploadId) => { @@ -154,6 +155,7 @@ Returns a promise with the string ID of the upload. Will reject if there is a c |`field`|string|Required if `type: 'multipart'`||The form field name for the file. Only used when `type: 'multipart`|`uploaded-file`| |`parameters`|object|Optional||Additional form fields to include in the HTTP request. Only used when `type: 'multipart`|| |`notification`|Notification object (see below)|Optional||Android only. |`{ enabled: true, onProgressTitle: "Uploading...", autoClear: true }`| +|`useUtf8Charset`|boolean|Optional||Android only. Set to true to use `utf-8` as charset. || ### Notification Object (Android Only) |Name|Type|Required|Description|Example| diff --git a/android/src/main/java/com/vydia/UploaderModule.java b/android/src/main/java/com/vydia/UploaderModule.java index c9a51de0..71aa0c8e 100644 --- a/android/src/main/java/com/vydia/UploaderModule.java +++ b/android/src/main/java/com/vydia/UploaderModule.java @@ -201,8 +201,14 @@ public void onCancelled(Context context, UploadInfo uploadInfo) { return; } - request = new MultipartUploadRequest(this.getReactApplicationContext(), customUploadId, url) - .addFileToUpload(filePath, options.getString("field")); + if(options.hasKey("useUtf8Charset") && options.getBoolean("useUtf8Charset")) { + request = new MultipartUploadRequest(this.getReactApplicationContext(), customUploadId, url) + .setUtf8Charset() + .addFileToUpload(filePath, options.getString("field")); + } else { + request = new MultipartUploadRequest(this.getReactApplicationContext(), customUploadId, url) + .addFileToUpload(filePath, options.getString("field")); + } }