File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed
Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -799,6 +799,9 @@ public void write(string options)
799799 return ;
800800 }
801801
802+ char [ ] dataToWrite = isBinary ? JSON . JsonHelper . Deserialize < char [ ] > ( data ) :
803+ data . ToCharArray ( ) ;
804+
802805 using ( IsolatedStorageFile isoFile = IsolatedStorageFile . GetUserStoreForApplication ( ) )
803806 {
804807 // create the file if not exists
@@ -817,12 +820,12 @@ public void write(string options)
817820 using ( BinaryWriter writer = new BinaryWriter ( stream ) )
818821 {
819822 writer . Seek ( 0 , SeekOrigin . End ) ;
820- writer . Write ( data . ToCharArray ( ) ) ;
823+ writer . Write ( dataToWrite ) ;
821824 }
822825 }
823826 }
824827
825- DispatchCommandResult ( new PluginResult ( PluginResult . Status . OK , data . Length ) , callbackId ) ;
828+ DispatchCommandResult ( new PluginResult ( PluginResult . Status . OK , dataToWrite . Length ) , callbackId ) ;
826829 }
827830 catch ( Exception ex )
828831 {
Original file line number Diff line number Diff line change @@ -118,7 +118,11 @@ FileWriter.prototype.write = function(data) {
118118
119119 // Mark data type for safer transport over the binary bridge
120120 isBinary = supportsBinary && ( data instanceof ArrayBuffer ) ;
121-
121+ if ( isBinary ) {
122+ // create a plain array, using the keys from the Uint8Array view so that we can serialize it
123+ data = Array . apply ( null , new Uint8Array ( data ) ) ;
124+ }
125+
122126 // Throw an exception if we are already writing a file
123127 if ( this . readyState === FileWriter . WRITING ) {
124128 throw new FileError ( FileError . INVALID_STATE_ERR ) ;
You can’t perform that action at this time.
0 commit comments