Output: Fix \u-format string escaping

This commit is contained in:
Katy Coe
2019-12-12 10:33:33 +01:00
parent 1ce823833f
commit 001e60dbde

View File

@@ -83,7 +83,7 @@ namespace Il2CppInspector.Reflection
// Standard escape characters // Standard escape characters
s.Append(escapeChars.ContainsKey(str[i]) ? escapeChars[str[i]] s.Append(escapeChars.ContainsKey(str[i]) ? escapeChars[str[i]]
// Replace everything else with UTF-16 Unicode // Replace everything else with UTF-16 Unicode
: str[i] < 32 || str[i] > 126 ? @"\u" + $"{str[i]:X4}" : str[i] < 32 || str[i] > 126 ? @"\u" + $"{(int) str[i]:X4}"
: str[i].ToString()); : str[i].ToString());
return $"\"{s}\""; return $"\"{s}\"";
} }