I am trying to download a text file from a server of mine, and have it display as a string. It works perfect on the simulator in Windows, but after uploading it to my android phone, all that shows up in place of the text is a rectangle box and an apostrophe, pretty much like this
[]’
Here are the parts of the code that have any interaction, and I cant seem to figure out what the problem is short of it not being able to properly interpret whats been downloaded
[lua]-- Text is the filename
network.download( url, “GET”, networkListener, text, system.DocumentsDirectory )[/lua]
The networkListener calls a function that is intended to read the file as a string
[lua]function readList(textFile)
texts2 = display.newText(“success2”, 100, 50, native.systemFont, 26)
local index = 1
local filePath = system.pathForFile( textFile, system.DocumentsDirectory )
local file = io.open( filePath, “r” )
function convert()
line = file:read("*a")
text462s = display.newText(line, 100, 200, native.systemFont, 26)
print(line)
end
if file then
convert()
else
text42s = display.newText(“errors”, 100, 200, native.systemFont, 26)
end
end[/lua]
While on the simulator on the computer everything shows up as it should, the phone does not. Another thing is that the file I upload onto my server has line breaks, but the one thats downloaded into my sandbox folder has no line breaks. I’ve tried the other way of requesting files that I found in the api, but it gave the same issues. This isnt necessarily a big issue, because I figure I can read it and convert it from there once its a string, but the main concern is the inability to read the file. [import]uid: 67886 topic_id: 21398 reply_id: 321398[/import]