Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-8008] MobileWeb : Utils - Ti.Utils.base64encode() is causing an error of "INVALID_CHARACTER_ERR: DOM Exception"

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2012-03-18T14:01:48.000+0000
Affected Version/sRelease 2.0.0
Fix Version/sRelease 2.0.0, Sprint 2012-06
ComponentsMobileWeb
Labelsqe-mw020912, qe-port
ReporterMichael Pettiford
AssigneeChris Barber
Created2012-03-14T13:41:13.000+0000
Updated2012-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

Comments

  1. Chris Barber 2012-03-14

    Whoops. Mobile Web's base64encode() only supports strings. I can add support for blobs.
  2. Chris Barber 2012-03-17

    Pull request: https://github.com/appcelerator/titanium_mobile/pull/1726
  3. Lokesh Choudhary 2012-08-08

    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

JSON Source