4 ms·
> > Java, C# and JS use UTF-16-like encoding for in-memory string > > That’s incorrect for Java, Maybe so, technically, but if you Base64 encode a string in
by mikojan 1y ago
> > Java, C# and JS use UTF-16-like encoding for in-memory string
>
> That’s incorrect for Java,
Maybe so, technically, but if you Base64 encode a string in a language that uses UTF-8 (or another UTF-16 with another endian) and decode it in Java, Java's UTF-16 representation will be the problem you will be dealing with.
- kelnos 1y agoThat's why when you are constructing a String with a byte array, you always, always, always use the constructor that also takes a character set.