If you already have a byte array then you will need to know what type of encoding was used to make it into that byte array.
(如果您已经有一个字节数组,那么您将需要知道使用哪种编码类型将其写入该字节数组。)
For example, if the byte array was created like this:
(例如,如果字节数组是这样创建的:)
byte[] bytes = Encoding.ASCII.GetBytes(someString);
You will need to turn it back into a string like this:
(您将需要将其重新变成这样的字符串:)
string someString = Encoding.ASCII.GetString(bytes);
If you can find in the code you inherited, the encoding used to create the byte array then you should be set.
(如果您可以在继承的代码中找到用于创建字节数组的编码,则应该进行设置。)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…