From time to time, I've noticed that Base64 encoding alone won't necessarily make it across the wire without some problem character. Therefore, I also wrap that Base64 encoded file with a GetAsUrlEncoded() function.
That extra GetAsUrlEncoded() adds to the time it takes to get the file encoded and on its way, so I was just wondering if anyone has noticed this problem character behavior using Base64 encoding alone.
Thanks,
I remember having this kind of issue 2 years ago. A Xojo Web app communicating with FMS experienced that - I think that was when FMS sent back the Base64 encoded file.
In my case it had to do with CR-LF sequences that were breaking decoding at the other end.
I googled to find the thread I crated on the Community, but didn't find it .
If I find something about my issue I will post back.
1 Like
Cool, yeah, the getAsUrlEncoding() is a workaround and I've never had a problem wrapping Base64 with GetAsUrlEncoded, but I was just wondering if anybody else had experienced this same issue.
To wit, GetAsUrlEncoded(Base64Encode(<container_field>)) always works.
Appreciate your reply.
Thanks, P.
Hi @anon45965781,
Just a note that, subsequent to the introduction of the Base64Encode function, FMP introduced the function: Base64EncodeRFC, which I believe should allow for encoding without line breaks interspersed in the output. I would think that should help, but I do not do enough work that involves Base64 encoding to be able to definitively make such a claim.
Hope this helps!
-steve
4 Likes
Thanks Steve! I'm not sure in my case it's a line break issue, but that's super good information to be reminded about. Perhaps this RFC idea warrants a test. If I can get away with not needing to use an extra encoding function, I would probably save a bit of time.
Perhaps @WimDecorte will jump in here also?
FWIW, I removed the GetAsUrlEncoded and just used Base64EncodeRFC() and no problems transferring file types like PDF, ZIP, HTML, and Open Document Format. Don't see a performance improvement, but that's OK.
Thanks again.
4 Likes
Hi @anon45965781,
Agreed that the source of the issue might not be limited to just the presence of line-breaks,
Edit: Good on you for giving it a spin! Glad to see that it is working.
All the best,
-Steve
2 Likes
Thanks Steve.
Since I control the service side too, it's not a big deal to remove the code that does the UrlDecode() and just rebuild and redeploy.
I'll try tomorrow with other file types, but it looks like there's no problem.
These FMP functions are rock solid.
4 Likes