base64.mod bug and fix...
BlitzMax Forums/Brucey's Modules/base64.mod bug and fix...| 
 | ||
| I've just hit an issue where decoded padded output would return invalid characters at the end of the string.  It seems String.FromBytes doesn't bother stopping when it hits a zero (most likely due to the unicode support). The TBase64.decode function was ending like this.. 
    Return String.FromBytes(outBuff, outBuff.length )
but padded output will leave zeros at the end of outBuff[] and these become invalid characters in the returned string (as I found out when I WriteLine'd them to a file). Replace that with this... 
    Local stringLength:Int = outbuff.length
    While ( outbuff[ stringLength - 1 ] = 0 )
        stringLength :- 1
    Wend 
    Return String.FromBytes(outBuff, stringLength )
 |