title: Base64 Android encode to PHP decode make error
body: <p>I'm a french guy, so, I'm sorry for my english...</p>
  
  <p>I'm developing an Android App which communicate with a PHP REST service. So, when I try to encode an image file into Base64 like this : </p>
  
  <pre><code>InputStream fileInputStream = context.getContentResolver().openInputStream(uri);
  BufferedInputStream in = new BufferedInputStream(fileInputStream);
  StringWriter out = new StringWriter();
  int b;
  while ((b = in.read()) != -1)
      out.write(b);
  out.flush();
  out.close();
  in.close();
  String encoded = new String(android.util.Base64.encode(out.toString()
              .getBytes(), android.util.Base64.DEFAULT));
  </code></pre>
  
  <p>On server side, I make : </p>
  
  <pre><code>$data=base64_decode(chunk_split($base64BinaryData));
  </code></pre>
  
  <p>The result is that my image file is corrupted!</p>
  
  <p>INFO : the image is made by an Intent to android.provider.MediaStore.ACTION_IMAGE_CAPTURE Activity in Emulator mode (avd 5554)</p>
  
  <p>I've already read lots of discussions about similar problem but nothing fix my bug.</p>
  
  <p>thanks for help</p>
  
  <p>Regards,</p>