Skip to content

Commit

Permalink
fallback to string
Browse files Browse the repository at this point in the history
  • Loading branch information
kblok committed Feb 18, 2025
1 parent 31e4471 commit be0bd92
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions lib/PuppeteerSharp/Helpers/Json/LowSurrogateConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,19 @@ public override string Read(ref Utf8JsonReader reader, Type typeToConvert, JsonS
var span = reader.HasValueSequence ? reader.ValueSequence.ToArray() : reader.ValueSpan.ToArray();
var value = Encoding.UTF8.GetString(span);

if (reader.ValueIsEscaped)
try
{
value = JsonUnescape(value);
}
if (reader.ValueIsEscaped)
{
value = JsonUnescape(value);
}

return value;
return value;
}
catch
{
return value;
}
}

public override void Write(Utf8JsonWriter writer, string value, JsonSerializerOptions options)
Expand Down

0 comments on commit be0bd92

Please sign in to comment.