Add Unicode detection in StreamDataReader

This commit is contained in:
miku-666
2022-07-21 23:50:04 +02:00
parent 66931beb62
commit eabac8a333
2 changed files with 2 additions and 2 deletions

View File

@@ -73,7 +73,7 @@ namespace PckStudio.Classes.IO
internal string ReadString(Stream stream)
{
int len = ReadInt(stream);
string s = ReadString(stream, len * 2, Encoding.BigEndianUnicode);
string s = ReadString(stream, len, Encoding.BigEndianUnicode);
ReadInt(stream); // padding
return s;
}

View File

@@ -17,7 +17,7 @@ namespace PckStudio.Classes.Utils
protected static string ReadString(Stream stream, int length, Encoding encoding)
{
byte[] buffer = ReadBytes(stream, length);
byte[] buffer = ReadBytes(stream, length << Convert.ToInt32(encoding is UnicodeEncoding));
return encoding.GetString(buffer);
}