{ "id": "62236", "key": "TIMOB-1604", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "11225", "name": "Release 1.5.0", "archived": true, "released": true, "releaseDate": "2010-12-14" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2012-05-14T14:49:57.000+0000", "created": "2011-04-15T02:57:11.000+0000", "priority": { "name": "Trivial", "id": "5" }, "labels": [], "versions": [], "issuelinks": [], "assignee": { "name": "ngupta", "key": "ngupta", "displayName": "Neeraj Gupta", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2012-05-14T14:49:58.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10202", "name": "Android", "description": "Android Platform" } ], "description": "{html}
You cannot use Titanium.Utils.base64encode &\r\nTitanium.Utils.base64decode successfully to round-trip the encoding\r\n/ decoding of a blob. In other words, you don't get back the same\r\nset of bytes that you originally started with.
\r\nFailcase app.js (make sure you have KS_nav_ui.png in your\r\nResources folder; it's there by default with new projects):
\r\n\r\n\r\nvar win = Ti.UI.createWindow({fullscreen: true, exitOnClose:true});\r\n\r\nvar file = Ti.Filesystem.getFile('KS_nav_ui.png');\r\n\r\nvar blob1 = file.read();\r\nvar base64 = Ti.Utils.base64encode(blob1);\r\nvar blob2 = Ti.Utils.base64decode(base64);\r\n\r\nvar thumbnail1 = Titanium.UI.createView({left: 0, top: 0, width: 46, height: 43});\r\nthumbnail1.backgroundImage = 'KS_nav_ui.png'; // the orig, which obviously works \r\nvar thumbnail2 = Titanium.UI.createView({left: 56, top: 0, width: 46, height: 43});\r\nvar thumbnail3 = Titanium.UI.createView({left: 112, top: 0, width: 46, height: 43});\r\nwin.add(thumbnail1); win.add(thumbnail2); win.add(thumbnail3);\r\n\r\nvar tempDir = Titanium.Filesystem.createTempDirectory();\r\ntempDir.createDirectory();\r\n\r\n// Blob from original file\r\nvar file1 = Titanium.Filesystem.getFile(tempDir.nativePath, 'file1.png');\r\nfile1.write(blob1);\r\nthumbnail2.backgroundImage = file1.nativePath;\r\n\r\n// Base64 encoded-then-decoded blob\r\nvar file2 = Titanium.Filesystem.getFile(tempDir.nativePath, 'file2.png');\r\nfile2.write(blob2);\r\nthumbnail3.backgroundImage = file2.nativePath;\r\n\r\nwin.open();
\r\n
\r\nYou should see three identical images when that runs. Instead,\r\nyou'll see only two.
(from [fd880341bc564607ed68650fd73660f57131d23f])\n[#1604 state:fixed-in-qa] When base64encoding a\nblob, don't force it to its string representation if you don't have\nto. That makes it unusable for binary files, images, etc. \nhttp://github.com/appcelerator/titanium_mobile/commit/fd880341bc564...
fixed on android using 1.4.1.ca7b78 device an simulator. Opening\na new issue for iOS to have functional parity.
#1611 for iOS