Question: I'm trying to read the `Image Data Url Content` from a photo taken with the `$cordovaCamera` plugin or from the gallery but I can't make it work. It always returns with `Error Code 5: ENCODING_ERR`. I also can't find what it means.

My current code is the following

```
var options = {
  quality: 50,
  destinationType: Camera.DestinationType.FILE_URI,
  sourceType: Camera.PictureSourceType.CAMERA,
  allowEdit: false,
  correctOrientation: true,
  encodingType: Camera.EncodingType.JPEG,
  saveToPhotoAlbum: false
};

$cordovaCamera.getPicture(options)
  .then(function (imageURI) {
    var indexOfLash = imageURI.lastIndexOf('/') + 1;
    var name = imageURI.substr(indexOfLash);
    var namePath = imageURI.substr(0, indexOfLash);

    return $cordovaFile.copyFile(namePath, name, cordova.file.dataDirectory, name);
  })
  .then(function (info) {
     console.log('copied', info);
     return $cordovaFile.readAsDataURL(cordova.file.dataDirectory, info.nativeURL);
   })
   .then(function (success) {
   // success
     console.log("image data", success);
   })
   .then(function () {
     $scope.profile = user.getProfile();
   })
   .catch(function (error) {
     console.log('Failed because', error);
   });

```

Answer: 
I figured out what I was doing wrong. Using JSON.stringify() on the img URL was adding double quotes around it. Removing it fixed the images:

`img = items.object;`
I'm not so sure about SDK permissions, but as a last resort you can turn the remote url into a resource URI like this - 

```
var res = Services.io.getProtocolHandler("resource").QueryInterface(Ci.nsIResProtocolHandler);
res.setSubstitution("rawr", Services.io.newURI('http://www.bing.com/',null,null));

// now try navigating to resource://rawr it will load bing

```

Then you can load `resource://rawr` and it should work.