Charsets for hex/base64
Weijun Wang
weijun.wang at oracle.com
Wed May 2 15:29:18 UTC 2018
> On May 2, 2018, at 4:35 PM, Jonas Konrad <me at yawk.at> wrote:
>
> "0a0b0c".getBytes(HexCharset.getInstance()) = new byte[] { 0x0a, 0x0b, 0x0c }
> new String(new byte[] { 0x0a, 0x0b, 0x0c }, HexCharset.getInstance()) = "0a0b0c"
Normally a charset is to encode a string to byte[], but here you can actually decoding a string to byte[]. This would lead to quite some concept differences.
For example, we can say if a char is encodable for a charset, but for the HEX "charset", you will have to say what combination of chars is "encodable".
--Max
More information about the core-libs-dev
mailing list