[英]How can i read valid utf-8 characters 0xC2 0x85 from an input stream which are outside the byte range in java?
I have an input stream that contains valid utf8 characters 0xC2 0x85 (U+0085). 我有一个输入流,其中包含有效的utf8字符0xC2 0x85(U + 0085)。 How can I read and print this correctly in java?
如何在Java中正确读取和打印此内容? using byte array doesn't help i think as 0x85 is out of range.
使用字节数组无济于事,我认为0x85超出范围。 Basically, I need to read utf8 characters coming from a socket in java which contains 0xC2 0x85
基本上,我需要读取来自Java中包含0xC2 0x85的套接字的utf8字符
If you have a valid stream in UTF-8 (is) then use 如果您在UTF-8(是)中拥有有效的流,请使用
Reader rdr = new InputStreamReader(is, "UTF-8");
this will convert UTF-8 bytes into Java chars 这会将UTF-8字节转换为Java字符
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.