You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by bo...@apache.org on 2012/04/10 23:39:21 UTC

[13/16] android commit: CB-453: FileWriter.append - Chinese characters are not appended to the file correctly

CB-453: FileWriter.append - Chinese characters are not appended to the file correctly


Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/commit/cb473dfe
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/tree/cb473dfe
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/diff/cb473dfe

Branch: refs/heads/CordovaWebView
Commit: cb473dfed4b3379ad3f67320008bd44428175177
Parents: 5d43835
Author: macdonst <si...@gmail.com>
Authored: Thu Apr 5 19:51:45 2012 -0400
Committer: macdonst <si...@gmail.com>
Committed: Thu Apr 5 19:51:45 2012 -0400

----------------------------------------------------------------------
 framework/src/org/apache/cordova/FileUtils.java |   20 +++++++++---------
 1 files changed, 10 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/cb473dfe/framework/src/org/apache/cordova/FileUtils.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/FileUtils.java b/framework/src/org/apache/cordova/FileUtils.java
index b2aa990..863da5b 100755
--- a/framework/src/org/apache/cordova/FileUtils.java
+++ b/framework/src/org/apache/cordova/FileUtils.java
@@ -973,23 +973,23 @@ public class FileUtils extends Plugin {
     /**/
     public long write(String filename, String data, int offset) throws FileNotFoundException, IOException {
         filename = stripFileProtocol(filename);
-
+        
         boolean append = false;
         if (offset > 0) {
             this.truncateFile(filename, offset);
             append = true;
         }
 
-       byte [] rawData = data.getBytes();
-       ByteArrayInputStream in = new ByteArrayInputStream(rawData);
-       FileOutputStream out = new FileOutputStream(filename, append);
-       byte buff[] = new byte[rawData.length];
-       in.read(buff, 0, buff.length);
-       out.write(buff, 0, rawData.length);
-       out.flush();
-       out.close();
+        byte [] rawData = data.getBytes();
+        ByteArrayInputStream in = new ByteArrayInputStream(rawData);
+        FileOutputStream out = new FileOutputStream(filename, append);
+        byte buff[] = new byte[rawData.length];
+        in.read(buff, 0, buff.length);
+        out.write(buff, 0, rawData.length);
+        out.flush();
+        out.close();
 
-        return data.length();
+        return rawData.length;
     }
 
     /**