mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/PCK-Studio.git
synced 2026-05-29 10:24:34 +00:00
Add Unicode detection in StreamDataReader
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user