Whoops that should be:
function urlSafeBase64 pData
local tEncoded
put base64Encode(pData) into tEncoded
// The engine’s base64Encode function formats the result as required for
// base 64 Content-Transfer-Encoding as discussed in RFC 4648
// section 3.1 and has linefeeds at 76 charac
> On 7 Feb 2025, at 9:54 AM, Bob Sneidar via use-livecode
> wrote:
>
> Hi Monte.
>
> Are you saying a base64encode string CAN contain the characters you listed?
> I’m talking about dash, underscore and equal. Or is that reference saying
> that plus and minus (dash) are interchangeable, alo
Hi Monte.
Are you saying a base64encode string CAN contain the characters you listed? I’m
talking about dash, underscore and equal. Or is that reference saying that plus
and minus (dash) are interchangeable, along with the slash and underscore
respectively?
Bob S
> On Feb 6, 2025, at 1:51
Hi Bob
> On 7 Feb 2025, at 3:28 AM, Bob Sneidar via use-livecode
> wrote:
>
> I don’t see any of those characters on base64encoded strings.
They definitely can be int there. Se RFC 4648 section 4 and 5 encoding tables
for reference.
https://datatracker.ietf.org/doc/html/rfc4648#section-5
C
I don’t see any of those characters on base64encoded strings.
Bob S
> On Feb 5, 2025, at 5:43 AM, Ralph DiMola via use-livecode
> wrote:
>
> I can see getting rid of extraneous CRs or LFs but aren’t "+","/" and "="
> part of the encoding and corrupt the base 64 data stream? Or am I missing
Well then that is now a function in my conversions library:
function urlSafeBase64 pData
replace return with empty in pData
replace "+" with "-" in pData
replace "/" with "_" in pData
replace "=" with empty in pData
return pData
end urlSafeBase64
Bob S
> On Feb 6, 2025, at 5:50
Hi Monte,
It works ! Thank you very much !
jbv
Le 2025-02-05 04:35, Monte Goulding via use-livecode a écrit :
Hi jbv
Here is my code for base64 encoding :
put URL ("file:" & "myfile.jpg") into timagedata
Use `binfile:` here instead of `file:` so the engine doesn’t treat the
data as nativ
You can also use a function and use the “post to url function”, built-in in
LiveCode, like this without any need for curl:
function ProcessOllamaText pText
put pText into tArr["prompt"]
put “You are a grumpy wizard, that doesn’t want to be disturbed as you
rather want to create new spells"