[TIMOB-8008] MobileWeb : Utils - Ti.Utils.base64encode() is causing an error of "INVALID_CHARACTER_ERR: DOM Exception"
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2012-03-18T14:01:48.000+0000 |
Affected Version/s | Release 2.0.0 |
Fix Version/s | Release 2.0.0, Sprint 2012-06 |
Components | MobileWeb |
Labels | qe-mw020912, qe-port |
Reporter | Michael Pettiford |
Assignee | Chris Barber |
Created | 2012-03-14T13:41:13.000+0000 |
Updated | 2012-08-08T16:26:14.000+0000 |
Description
Steps to reproduce:
1. Create a default mobile web app and replace the code in app.js with the following
var win = Titanium.UI.createWindow({
title : 'test',
backgroundColor : 'white'
});
win.open();
var f = Ti.Filesystem.getFile(Ti.Filesystem.resourcesDirectory, 'KS_nav_ui.png');
var blob = f.read();
var encoded = Ti.Utils.base64encode(blob);
alert(encoded);
Actual result:
An error of "INVALID_CHARACTER_ERR: DOM Exception" is caused by the line var encoded = Ti.Utils.base64encode(blob);
Expected result:
An alert is displayed with a base 64 version of the file
Whoops. Mobile Web's base64encode() only supports strings. I can add support for blobs.
Pull request: https://github.com/appcelerator/titanium_mobile/pull/1726
Tested On: Titanium studio : 2.1.1.201207271312 SDK version : 2.2.0.v20120807144112 Android 4.0.4 - default ,chrome 18.0 Iphone 4.3.5 - safari mobile Mountain lion(10.8) - chrome 21.0,safari 5.1.4,firefox 14.0.1