Base64 weirdness
Maarten Koopmans
maarten.koopmans at gmail.com
Sat Oct 29 12:30:51 EDT 2011
You're right, but i've found that other languages don't ignore them,
whether they are c-based string wrapped scripting languages or compile to
the JVM for instance.....
I think LC follows the RFC better, but not necessarily better interoprable.
Anuway, another recent thread turned out to have a solution - copy 72
chars, skip 1, loop
--Maarten
On Saturday, October 29, 2011, Richard Gaskin <ambassador at fourthworld.com>
wrote:
> Maarten Koopmans wrote:
>
>> Sorry for the cross-post from the forum, but this (silly) thing is
>> becoming a blocker.
>>
>> A (to me) subtle question, which has to do with the base64 encoding. A
>> base 64 encoded binary needs to be a multiple of 4. It' what all other
>> implementation seem to do as well (tested Scala (JVM) and REBOL (C
>> underneath)).
>>
>> But if I test with a standalone file like this:
>>
>> put "/Users/maartenkoopmans/Desktop/pw.jpg" into tFilename
>> put base64encode(url("binfile:" & tFilename)) into tImage
>> answer "file read and converted"
>> answer the length of tImage
>>
>> I consistently get 7758 as length in Livecode, and 7652 in other
>> implementaions (REBOL, Scala). The LC form has two bytes to much to be
>> multiple of 4, and way more than the others, which are multiples of
>> fours. So how do you get your data back then to display the image in a
>> different environment (say, as webserver....)?
>>
>> Any thoughts appreciated...
>
> What others wrote about line endings is likely the explanation.
>
> But since base64 implementation should ignore line endings, how is this a
blocker for you? What software is not unencoding those correctly?
>
> --
> Richard Gaskin
> Fourth World
> LiveCode training and consulting: http://www.fourthworld.com
> Webzine for LiveCode developers: http://www.LiveCodeJournal.com
> LiveCode Journal blog: http://LiveCodejournal.com/blog.irv
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
More information about the use-livecode
mailing list