[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #62919] base64_decode() cannot decode base64_e
From: |
Markus Mützel |
Subject: |
[Octave-bug-tracker] [bug #62919] base64_decode() cannot decode base64_encode() content |
Date: |
Fri, 19 Aug 2022 10:37:26 -0400 (EDT) |
Update of bug #62919 (project octave):
Status: None => Invalid
Open/Closed: Open => Closed
Operating System: GNU/Linux => Any
_______________________________________________________
Follow-up Comment #1:
Confirmed with Octave 7.2.0 on Windows.
However, as the documentation states:
https://docs.octave.org/v7.2.0/Base64-and-Binary-Data-Transmission.html
> Encode a double matrix or array x into the base64 format string s.
So, it is only meant to work for *double* matrix input (not *int8* like in
your example).
The following (Matlab compatible) functions work for me for the input in your
example:
result = matlab.net.base64encode (int8 ('[0,1,2]'))
char (matlab.net.base64decode (result))
However, that is a new function in Octave 7.
In older versions, the workaround is a bit more involved:
result = base64_encode (typecast ([input, zeros(1, 8-mod(numel(input), 8))],
'double'))
char (typecast (base64_decode (result), 'int8'))
You might still need to strip padding zeros from the result at the end.
Anyway, closing as invalid because this is not supposed to work according to
the function documentation.
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?62919>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/