Manatee.Json
Manatee.Json copied to clipboard
Replace invalid utf-32 characters with U+FFFD � REPLACEMENT CHARACTER (0xFFFD)
Describe the bug We need to replace invalid utf-32 characters with the Replacement Character
Expected behavior The expected behavior is to replace invalid utf-32 characters with the Replacement Character
Additional context The Replacement Character is used to replace invalid characters. Golang do that in their JSON standard library
Maybe something like this:
int.TryParse(source.Substring(index, 4), NumberStyles.HexNumber, CultureInfo.InvariantCulture, out int hex)
if (!hex.IsValidUtf32CodePoint()) hex = 0xFFFD;
Thanks for the suggestion, but I'm not sure that this behavior is in line with JSON.
Lastly, this project is no longer active.