From 0a0876c33747c5c1b3a9a2788c63d0fc3d1ad601 Mon Sep 17 00:00:00 2001 From: Katy Coe Date: Fri, 10 Nov 2017 14:09:49 +0100 Subject: [PATCH] Fix some UTF-8 encoding bugs --- Il2CppDumper/Il2CppDumper.cs | 3 ++- Il2CppInspector/Il2CppInspector.cs | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Il2CppDumper/Il2CppDumper.cs b/Il2CppDumper/Il2CppDumper.cs index d0da381..ec6b3b5 100644 --- a/Il2CppDumper/Il2CppDumper.cs +++ b/Il2CppDumper/Il2CppDumper.cs @@ -4,6 +4,7 @@ using System.IO; using System.Linq; using System.Reflection; +using System.Text; using Il2CppInspector.Reflection; namespace Il2CppInspector @@ -17,7 +18,7 @@ namespace Il2CppInspector } public void WriteFile(string outFile) { - using (var writer = new StreamWriter(new FileStream(outFile, FileMode.Create))) { + using (var writer = new StreamWriter(new FileStream(outFile, FileMode.Create), Encoding.UTF8)) { foreach (var asm in model.Assemblies) { writer.Write($"// Image {asm.Index}: {asm.FullName} - {asm.Definition.typeStart}\n"); } diff --git a/Il2CppInspector/Il2CppInspector.cs b/Il2CppInspector/Il2CppInspector.cs index 3b03d0e..d3077ef 100644 --- a/Il2CppInspector/Il2CppInspector.cs +++ b/Il2CppInspector/Il2CppInspector.cs @@ -58,7 +58,8 @@ namespace Il2CppInspector value = Metadata.ReadByte(); break; case Il2CppTypeEnum.IL2CPP_TYPE_CHAR: - value = Metadata.ReadChar(); + // UTF-8 character assumed + value = BitConverter.ToChar(Metadata.ReadBytes(2), 0); break; case Il2CppTypeEnum.IL2CPP_TYPE_U2: value = Metadata.ReadUInt16();