From what I understand, encoding and underlaying bytes of data are not connected, only with correct encoding information you can display text correctly (from raw bytes).
However, String can be constructed with encoding in mind (and consequently it is not just plain byte array), probably there is a way to retrieve it somehow?
The charset is not stored in the String. The string content encoding is implicit and is always UNICODE stored as UTF16 code points. The charset parameter is required for the constructor to be able to know how to convert the bytes to UTF16 code points.
Joined: Sep 14, 2012
Thanks, you're right. All strings are internally stored in common format, so you can for example compare them regardless of their encoding (I checked this).