Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想我可以用\u****UTF16 来构造一个字符,如何用 UTF8 构造一个字符串?
\u****
接受的答案很有用,但实际上并没有说明如何从 UTF-8 数据构造字符串。
以防万一有人想知道答案,这里是:
byte[] bytes = ...; // UTF-8 bytes. String string = new String(bytes, "UTF-8");