UTF8, Base64 and RLE functions

Monkey Forums/Monkey Code/UTF8, Base64 and RLE functions

skid(Posted 2011) [#1]
The following functions have not been totally stress tested but may be useful for those wanting to pack integer data into strings for use with SaveState command.

The RunLength32 encoding compresses 32 bit data by packing repeats of 4 or more similar integers.

The UTF8 functions pack 32 bit data into sequence of 8 bit bytes. Unlike standard 31 bit UTF8 negative / 32 bit values are supported.

The Base64 functions are standard Mime64 encoding of bytes minus the line breaks.




AdamRedwoods(Posted 2013) [#2]
Sorry to revive, but just an FYI--

That base64 encoder gave me slightly different results when compared one-to-one with a decoded set. I think "0" was converted to "-1".
Here's the code I used and I know this works (tested):



Amanda Dearheart(Posted 2013) [#3]
Are these memory saving functions?
If not, what use are these functions?


AdamRedwoods(Posted 2013) [#4]
base64 is an encoding scheme using alpha-numeric characters. useful in monkey for embedding data into monkey files.
it does not save memory, but rather uses 33% more memory.

RLE, on the other hand, is a simple compression scheme.

utf8 is a character encoding scheme for international languages. utf8 is automatic for most monkey strings.


skid(Posted 2014) [#5]
Adam, I have tried to reproduce the issue but failed, What ever I throw at it your Encode function returns same string as my Base64Encode function.