C
C#2y ago
Chihuahua

❔ How can I deal with '+' deserializing to \u002B when de-serializing json back to a string?

How can I deal with '+' deserializing to \u002B when de-serializing json back to a string? I know I could just do a replace, but there must be a more elegant solution right? Since \u002B is not equal to '+' when comparing the strings.
2 Replies
Chihuahua
Chihuahua2y ago
And what the the implications of just using: System.Text.Encodings.Web.JavaScriptEncoder.UnsafeRelaxedJsonEscaping; This is stored in localstorage so end users can edit it After a bit more reading it seems like it should be safe to use UnsafeRelaxedJsonEscaping since I will not be putting the deserialized data into an HTML page, is this a correct understanding I think I can just bypass the whole issue by not serializing the string.. thanks anyone that read my rubber ducking with myself
Accord
Accord2y ago
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.