请问 string s = Encoding.UTF8.GetString(bytes); 这条代码发生了什么? 按我自己的理解string不是一个utf-16字符序列吗? RRS feed


  • Hi   雷开封,

    >> string s = Encoding.UTF8.GetString(bytes); 

    这段代码是将bytes 字节以 UTF8【编码规则】的编码方式显示字符。

    Best Regards

    Yong Lu

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact

    2019年4月12日 6:56
  • 如果string是utf-16编码,那么Encode.UTF8.GetString就是将UTF8字节流转换为utf-16字符序列。
    2019年4月12日 7:31