DecodeBase64 gives junk not folderitem

For some reason an encoded item got corrupted and I don’t have a good test for it.

[code]tsPath = TitPthArray(i).NthField(Chr(9), 2)//the second half of the string coming from storage
ts = DecodeBase64(tsPath, Encodings.UTF8)//the string decoded but it’s junk. So junky it won’t even copy to the clipboard

tsfb = GetFolderItem(ts, 3)//.Child(“PrefsFile”)//How do I test before here?[/code]
I don’t know a test since it’s not empty. Suggestions?

Please post the entire source string here in a code block to start with.

tsfb can be tested with tsfb.exists.

There should be only one non-visual character - a tab.
I tried, just to see if I’d missed it, If tsfb.Exists = GetFolderItem(ts, 3) because it is thrown on that line and the compiler responds
Undefined operator. Type Boolean does not define “=” with type FolderItem.

I just decoded it… and the middle is a valid path
\Users\Arthur Gabhart\Documents\Basic Programming\ReviewCards\Data\Base

I would check the encoding of the string at the point you ENCODED the string
and since you a taking a substring to make TSPath, this just adds to the situation

Thanks. That is the path it should be.
For some reason I got junk before and I don’t now. My next problem is a file on that path that does exist, but when I run this code in the debugger, I get a nilobjectexception. This is my code:
[code]If tsfb.Child(“PrefsFile”).Exists = False Then
tsf = Nil
Else
tsf = tsfb.Child(“PrefsFile”)

			End If[/code]

Suggestions?

Try

tsfb = GetFolderItem(ts, 3)
if tsfb <> Nil and tsfb.Exists then
    tsfb = tsfb.Child("Preferences")
else
   // error condition
end

How can you know that ?

Do you check what is in the Clipboard using a specialized application * ?

Other question(s):
I read your (valid) question, but you do not explain why you have a BASE64 string (object).
How do you know about an Encoding set to the data before been BASE64 encoded ?
What was the “string” before been BASE64 encoded ?

There exists a Method in the FolderItem Class whose name is GetSaveInfo . The BASE64 “object” may simply hold that information. Note: There is many years since the last time I use this Method: I may be wrong here.

  • Remember: you can put whatever you want in the Clipboard. What can be difficult is where to put your data from the Clipboard: you cannot Paste an image in a Text Editor (usually, a Text Editor does not allows that). As an example, you cannot paste an image in Xojo’s Code Editor.

Emile. You are correct.
My code is from a uhmm self-contained program. It doesn’t get the code via anything like a network or the internet, only the platform (Mac or PC) it’s on.

I didn’t explain how I added XOJO’s clipboard and lines to my program (to test the new method to me) txt=Str.ToText. I didn’t include the code since it doesn’t work apparently on translating a String that is a folderItem to text. If it does, I’d like to know.

I also didn’t explain that I wrote the code to save file that contained this Encoded Base64 line.
Sorry.