Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

android Ti.Util.base64encode returns object

Titanium.Utils.base64encode(str) returns an object, and not a string as expected. is this a bug or do i miss something?
thx, u.

— asked August 4th 2010 by u no
  • android
  • base64encode
  • ti.utils
0 Comments

4 Answers

  • some problem here! watsup?

    — answered August 4th 2010 by fa fa
    permalink
    0 Comments
  • I have the same problem….

    — answered October 23rd 2011 by Knut Inge Grosland
    permalink
    0 Comments
  • It returns a Blob call getText() on it to get the String form.

    — answered October 25th 2011 by Don Thorp
    permalink
    0 Comments
  • Thanks Don.
    Seemes like this is been missin in the documentation (Blob) …

    I get an exception now:

    var f = Ti.Filesystem.getFile("img/Logga.png");
    var blob = f.read();
    var base = Titanium.Utils.base64encode(blob.getText());
    Ti.API.info(base);
    

    return:

    Terminating app due to uncaught exception 'org.tavlan.UtilsModule', reason: 'Invalid type passed to function. invalid type  in -[UtilsModule convertToString:] (UtilsModule.m:31)'
    
    — answered October 25th 2011 by Knut Inge Grosland
    permalink
    1 Comment
    • opps sorry for the bad English. I can not edit :-)

      — commented October 25th 2011 by Knut Inge Grosland
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.