The issue: decoding Fz+= then encoding it back yields Fz8=
The following code:
new String(Base64.getEncoder().encode(Base64.getDecoder().decode("Fz+=".getBytes("UTF-8"))))
Gives the following String: Fz8=
How did the + become an 8?
I must be missing something here.
Fz+= in bit pattern: 000101 110011 111110 000000
rearranged in 8bit groups: 00010111 00111111 10000000
In decimal: 23 63 128
which would need 3 bytes to represent it.
However when I try just this code:
Base64.getDecoder().decode("Fz+=".getBytes("UTF-8"))
I get the following array in decimal:
[23, 63]
Where did the last byte (1000 0000) go ? It's the reason the + turned into an 8 when we encoded it.
UTF-8conversion? Not entirely sure but this article might be helpful. Looks like it has to do with how the128is expanded to multiple bytes.