Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-18505] Difference in output when printing a text Blob to the console in Android and iOS

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionInvalid
Resolution Date2018-01-03T03:31:03.000+0000
Affected Version/sRelease 3.4.1, Release 3.5.0, Release 4.0.0
Fix Version/sn/a
ComponentsAndroid, iOS
Labelsqe-4.0.0
ReporterEwan Harris
AssigneeMaggie Chen
Created2015-02-03T23:33:15.000+0000
Updated2018-01-03T03:31:03.000+0000

Description

Description

When printing a text blob to a console in iOS the output is simply what was in the document you have read for example
 
[INFO] :   This is not test text.
However when the same code is run on Android, a JSON structure is printed out containing the information, for example
[INFO] :   {"file":{"hidden":false,"nativePath":"file:///android_asset/Resources/test2.txt","writable":false,"executable":false,"parent":null,"readonly":true,"directoryListing":[],"size":22,"apiName":"Ti.Proxy","name":"test2.txt","symbolicLink":false,"bubbleParent":true},"nativePath":"file:///android_asset/Resources/test2.txt","height":0,"length":22,"width":0,"mimeType":"text/plain","apiName":"Ti.Blob","text":"This is not test text.","type":1,"bubbleParent":true}
This *is not a regression.* As it occurs in previous versions of the SDK.

Steps To Reproduce

1. Replace the app.js in an existing project with the attached app.js, add the file test.txt to the Resources folder 2a. Run the app on an iOS device 2b. Run the app on an Android device

Actual Result

2a. The text from the document will be printed out in the console 2b. A JSON structure representing the blob will be printed out in the console

Expected Result

The result should be the same, as there is both a toString method and a text to get the text of the document, it may make more sense to return the JSON structure.

Attachments

FileDateSize
app.js2015-02-03T23:33:15.000+0000305
test.txt2015-02-03T23:33:15.000+000022

Comments

  1. Maggie Chen 2017-09-21

    Please refer to the example in [http://docs.appcelerator.com/platform/latest/#!/api/Titanium.Filesystem.File] The text is returned as expected by using: console.log(blobText.text);

JSON Source