Dim MyFile as FolderItem = ... // the location has been defined
Dim S as string
Dim TIS As TextInputStream
If MyFile <> nil and MyFile.isReadable then TIS = TextInputStream.Open(MyFile)
S = TIS.ReadAll
TIS = nil
S = Decodebase64(S) // The data was encoded like this EncodeBase64(TheText, 0)
EditField3.Text = S
The encoded string is not empty still I am getting an empty string returned.
But still the decoded text is not being displayed…
Further on, I have
Dim f as folderitem
f = GetFolderitem(S)
If f <> nil and f.isReadable then f.launch
… and f is launched!
I can’t figure that out,.
The real problem is this…
I have a a launcher app.
It has several imageWells that have the icons of folder items that were dropped on to the imageWells.
On dropping a folderitem on an imageWell the icon of the folder item is displayed in the imageWell.
A shellpath is stored for that folder item so that when the imageWell is clicked the folder item is launched.
The app works well on a Windows 32 bit OS.
When I put the folder that has those shell paths in a Windows 64 bit OS the problem arises…
A Windows 64 bit OS has Program Files and Program Files (x86)
The shellpaths are indicating Program Files and not Program Files (x86)
So I would like to change the logic to
Pseudocode - isWOW is a method that indicates if the OS is 64 Bit
If isWOW then change those shellpaths from Program Files to Program Files (x86)
If indeed S contains encoded text, then the only two lines where the issue can lie are :
S = Decodebase64(S) // The data was encoded like this EncodeBase64(TheText, 0)
EditField3.Text = S
You want to place a break after the first line and check in the debugger if now it contains decoded text.
If it does and somehow line 2 does not places the text in EditField3, then your code is haunted.
Seriously, all other considerations are of the same nature as the proverbial red herring.
I very much doubt S contains anything at the entry of these two lines. I tried with a small project here, and if indeed S contains encoded text, there is no way in this space time continuum what comes out of the first line can be empty.
[quote=220906:@Lennox Jacob]Yes I put a break at the second line and yes there is text in the debugger
S then some garbled characters then the expected decoded text.
OK, I think the problem would be like this…
I use Mac and sometimes I transfer files from my PC to my Mac, I don’t know if those characters are being added in the transfer.
I will check that and see.[/quote]
Forgive me, but I do not follow. If indeed S contains the expected text after the first line, that would mean somehow EditField3.Text does not display whatever you set it with.
I frankly do not see what transferring to a Mac would have to do with that…
Tiny possibility… very long shot…if the file comes over via FTP and its not set to binary mode, maybe windows line ends are being turned into Unix line endings and screwing it up?
OK I just re-created the files on my PC and the same thing happens…
In the debugger there are these garbled characters - 5 of them and some spaces - then the expected text appears but TextField3 does not display any text. The files does not go over FTP.
[quote=220906:@Lennox Jacob]Yes I put a break at the second line and yes there is text in the debugger
S then some garbled characters then the expected decoded text.[/quote]
If I understand right what he writes, S does contain the decoded text just before he sets EditField3.Text with it.
OK I got a temporary work around using nthFields, so I can now do some detailed checks to correct the garbled text that was included and have it working the correct way.
Thanks Michel
If indeed S contains encoded text, then the only two lines where the issue can lie are :
S = Decodebase64(S) // The data was encoded like this EncodeBase64(TheText, 0)
EditField3.Text = S
You want to place a break after the first line and check in the debugger if now it contains decoded text.
…was the most helpful part.
Unless there are stray (garbled) characters in S before you decode it, then those extra characters are part of your encoded string, which means they were in the string before you encoded it and wrote it to the file in the first place.
Can you post the encoded string?
Oh, and bad characters in a string CAN cause it not to display. No real mystery there.
The problem was this… To save the path I used this
TOS.writeline encodeBase64(f.GetSaveInfo (f, 2))
Then I encoded it and that was the problem…
The LR states - NOTE: The returned string is not intended to be human-readable and any modifications may render it useless.
I now use this
TOS.writeline encodeBase64(f.NativePath, 0) ’ TOS.writeline encodeBase64(f.GetSaveInfo (f, 2)) ’
encode it, and all works great.